Code: Select all
bind pub o|o !kick pub_kick
proc pub_kick {nick uhost hand chan arg} {
  # Person to kick is first arg
  set target [lindex $arg 0]
  # Kick message is remaining words
  set kickmsg [lrange $arg 1 end]
  ...
}
So, how do you solve this problem? A lot of scripts use an ugly hack (regsub) to add slashes into the string. That is the wrong way. Tcl provides a command called split that splits a string into a proper list. Each word in the string becomes an element in the list.
Therefore the quick fix for this error is to replace $arg with [split $arg] whenever lindex or lrange is used.
For instance, the above script can be fixed like this:
Code: Select all
bind pub o|o !kick pub_kick
proc pub_kick {nick uhost hand chan arg} {
  # Person to kick is first arg
  set target [lindex [split $arg] 0]
  # Kick message is remaining words
  set kickmsg [lrange [split $arg] 1 end]
  ...
}
If you need more explanation, please post questions below. Not currently possible