First of all..using 'args' as a variable name is probably a bad idea for the script you're making. 'args' is treated in a special way when used as the last argument name in a proc. It will let your proc be called with zero to infinite number of arguments from that point and all the args are stuffed into a list in the variable inside the proc. So for your proc called by a pub bind (i'm guessing here) with a fixed number of arguments this will only lead to having to strip of a layer of list before you start working with the contents.
Short version: find another variable name than 'args'.
The command you're looking for is probably 'lrange'. Like 'lindex' it is a list command and requires a list to work properly, so make sure you 'split' the string before using any of those commands. You'll probably want to 'join' the list returned by lrange before you send the message btw
proc send:msg {nick uhost hand chan arg} {
global msg send:msg
set usr [lindex $arg 0]
set text [lindex $arg 1]
putquick "NOTICE $nick : Sending msg.."
putserv "PRIVMSG $usr: mybot is sending you this text #$text"
putserv "NOTICE $nick : Succesfully send msg to [lindex $arg 0]"
}
if i do this
putserv "NOTICE $nick : Succesfully send msg to [lindex $arg 0] test tes test [lindex $arg 0]"
Heh, I think he said to try the { because it will create an error. Your script uses set usr [lindex $arg 0], but if $arg isn't a proper list (like {blah {blah) then it will cause a tcl error. You should put:
proc send:msg {nick uhost hand chan arg} {
global msg send:msg
set arg [split $arg]
set usr [lindex $arg 0]
set text [lindex $arg 1]
putquick "NOTICE $nick :Sending msg.."
putserv "PRIVMSG $usr :mybot is sending you this text #$text"
putserv "NOTICE $nick :Succesfully send msg to [lindex $arg 0]"
}
proc send:msg {nick uhost hand chan arg} {
global msg send:msg
set arg [split $arg]
set usr [lindex $arg 0]
set text [lindex $arg 1]
putquick "NOTICE $nick :Sending msg.."
putserv "PRIVMSG $usr :mybot is sending you this text #$text"
putserv "NOTICE $nick :Succesfully send msg to [lindex $arg 0]"
}
for example next question would be
set arg [split $arg] #do i remove this if i add what you say
set usr [lindex $arg 0] #what about this arg ?? do i change anything about it
if you just add it to the script i see probably understand if i don't understand ill ask again .. and it only takes a second ..
The { is there because lrange returns a list. In Tcl, when you print a list as text, it puts { } around it so you know it's a list. To make it into a proper string, you have to use the 'join' command (which joins the elements into a string). Note, lindex also returns a string, because this is a list of strings (words). So, it should look like this:
set arg [split $arg]
set usr [lindex $arg 0]
set text [join [lrange $arg 1 end]]