This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

invalid command name

Old posts that have not been replied to for several years.
Locked
x
xavia

invalid command name

Post by xavia »

Hello,

I am working on a TCL script that receives commands from an external script with use of the 'listen <port> script <proc>'. My problem doesn't really have to do with that, but it's good to have background information.

My problem is: Tcl error [listen:controller]: invalid command name "STEAM_0:1:2128306"

STEAM_0:1:2128306 is NOT a command, it shouldn't be one, it is just data being passed to a proc from another proc.

The code below is the proc where the error occurs, and the $steam variable (where STEAM_0:1:2128306 would be stored) is only used once in the last elseif.

Code: Select all

proc listen:controller {idx input} {
    # We will be quiet until we recieve a valid login string
    if {$input == ""} {
        # Client Disconnect
        return 1
    }

    if {[regexp {^say\s(.+)$} $input match text]} {
        putquick "PRIVMSG # :$text"
    } elseif {[regexp {^world_event\s"([^"]+)"$} $input match event]} {
        out:world_event $event
    } elseif {[regexp {^player_kill\s"([^"]+)"\s(CT|T)\s"([^"]+)"\s(CT|T)\s"([^"]+)"$} $input match plyr1 team1 plyr2 team2 w$
        out:player_kill $plyr1 $team1 $plyr2 $team2 $weapon
    } elseif {[regexp {^player_connect\s"([^"]+)"\s(\d+)\s(\S+)\s(CT|T)$} $input match name id steam team]} {
        out:player_connect $name $id $steam $team
    }

}
I don't quite understand why TCL is thinking STEAM_0:1:2128306 would be a command, so I am really stuck. Any help would be appreciated.

Also I am curious if anyone has comments on my use of regexp. Is it a good idea to use it like that, or is there a better more efficient way to accomplish the same thing in TCL?

Matt
D
DrN

Post by DrN »

Check whatever is sending the data to the bot to make sure it's not sending it encased in []s. IE: [STEAM_0:1:2128306].
x
xavia

Post by xavia »

Hi,


I never really figured out why it was doing the 'invalid command name' before, but I made a workaround, and it was working again. Now I am getting the same error but with a different variable. This is getting annoying and I am pretty close to just making a simple perl irc bot instead of eggdrop. But I will give it one more try if someone could please give me some assistance and either tell me what I am doing wrong, or point me in the right direction.

Error: Tcl error [listen_controller]: invalid command name "12"

12 is just a number, or at least is should be only a number.

This only happens when I am trying to call a proc, not when I just manipulating the string. It looks fine when I output it, so I don't know why TCL is trying to make it something it isn't.

[20:55] cmd: player_kill args: "[DZ]-axel <3 meg the angel" 18 "STEAM_0:1:422302 T 12 0" "(f)-DS" 21 "STEAM_0:0:73139 CT 8 1" "ak47"

Is there something I am doing wrong, or maybe a better way to formatt my messages to the eggdrop to make this problem never happen?

Code: Select all

proc listen_controller {idx input} {
    global reportchan
    # We will be quiet until we recieve a valid login string
    if {$input == ""} {
        # Client Disconnect
        putquick "PRIVMSG $reportchan :Streamer Disconnected! Match Relay Disabled."
        return 1
    }

    set cmd [lindex [split $input] 0]
    set arg [join [lrange [split $input] 1 end]]
    putlog "cmd: $cmd args: $arg"
    if {[regexp {^say\s(.+)$} $input match text]} {
        putquick "PRIVMSG #matchbot-priv :$text"
    } elseif {[string equal $cmd world_event]} {
        out_world_event $arg
    } elseif {[string equal $cmd player_kill]} {
        out_player_kill $arg
    } elseif {[string equal $cmd player_join]} {
        out_player_join $arg
    } elseif {[string equal $cmd player_connect]} {
        out_player_connect $arg
    } elseif {[string equal $cmd player_validate]} {
        out_player_validate $arg
    } elseif {[string equal $cmd player_enter]} {
        out_player_enter $arg
    } elseif {[string equal $cmd player_disconnect]} {
        out_player_disconnect $arg
    } elseif {[string equal $cmd player_event]} {
        out_player_event $arg
    } elseif {[string equal $cmd team_event]} {
        out_team_event $arg
    }
}
That is the proc the error happens in. Also if it makes any difference, I am using the 'listen <port> script <proc>' command, which receives commands from a perl daemon.

xAvia
x
xavia

Post by xavia »

Code: Select all

listen **** script listen_init

set reportchan "#matchbot-priv"

proc listen_init {idx} {
    global reportchan
    # Client Connect
    putdcc $idx "connected"
    putquick "PRIVMSG $reportchan :Steamer Connected! Match Relay Enabled."
    control $idx listen_controller
}
This is the code where the listen_controller is binded to the listen socket. Just a control statement, so the text that is given to the proc is formatted by eggdrop.

xAvia
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

The problem can be in one of the procedures out_world_event , out_player_kill etc. etc.

Add putlog statements to these procs and see in what procedure and at which point in the procedure the error occurs.

Based on what you have posted it is difficult to locate the source of the error.
Locked