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
}
}
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