I guess that wasn't really that clear, so what im trying to do is having people message the bot with: !add bob is cool and having it put in the text file I set, but like this:
[word1]
bob
[word2]
is
[word3]
cool
Is it possible?
Code: Select all
set word1 [lindex $text 0]
set word2 [lindex $text 1]
set word3 [lindex $text 2]
Code: Select all
proc addstrings {nick uhost w1 w2 w3 text} {
global mainchan file
putserv "NOTICE $mainchan : $nick ( $uhost ) adding $text to $file"
set fs [open strings.txt w]
set w1 [lindex $text 0]
set w2 [lindex $text 1]
set w3 [lindex $text 2]
puts $fs "1. $w1 2. $w2 3. $w3"
close $fs
putserv "NOTICE $mainchan : $text added."
return 1
}
I'm guessing you see an error in the partyline saying something to the effect of: "proc addstrings called with not enough arguments"jimmyx wrote:I'm guessing its either a stupid noob mistake -- or I should start reading up the tcl documentation some more. But here's a snipplet of what I have:
It won't write anything to strings.txt..Code: Select all
proc addstrings {nick uhost w1 w2 w3 text} { global mainchan file putserv "NOTICE $mainchan : $nick ( $uhost ) adding $text to $file" set fs [open strings.txt w] set w1 [lindex $text 0] set w2 [lindex $text 1] set w3 [lindex $text 2] puts $fs "1. $w1 2. $w2 3. $w3" close $fs putserv "NOTICE $mainchan : $text added." return 1 }
I have addstrings binded to a msg, could that be why its not working? what could i use other than $text?
I've just recently started messing around with tcl..so I don't really understand much.