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.
Help for those learning Tcl or writing their own scripts.
ache
Voice
Posts: 14 Joined: Fri Oct 14, 2005 7:27 am
Post
by ache » Tue Nov 01, 2005 8:55 am
I working on a simple greet script but have encountered some problems.
this is what the script looks like so far.
Code: Select all
proc pub:checkgreet {nick uhost handle channel arguments } {
list arguments $arguments
set greet.nick [lindex $arguments 0]
set greet.channel [lindex $arguments 1]
set greet.text [lrange $arguments 2 end]
putlog "1 Greet nick: $greet.nick Greet channel: $greet.channel Greet text: $greet.text"
if {([string index $greet.channel]=="#")} {
[pub:addgreet $greet.nick $greet.channel $greet.text]
} elseif {($greet.channel=="all")} {
[pub:addgreet $greet.nick $greet.channel $greet.text]
} else {
putquick "PRIVMSG $nick : Please state a channel to greet in. \026!chelp !addgreet\026 for more info."
return
}
putlog "2 Greet nick: $greet.nick Greet channel: $greet.channel Greet text: $greet.text"
}
proc pub:addgreet {greet.nick greet.channel greet.text} {
}
proc pub:delgreet {nick uhost handle channel args } {
}
the error i get is this
Code: Select all
Tcl error [pub:checkgreet]: syntax error in expression "($greet.channel=="all")": looking for close parenthesis
I cant fingure out what the problem is..
any help would be greatly appreciated.
thanks
Last edited by
ache on Tue Nov 01, 2005 12:35 pm, edited 2 times in total.
ache
Voice
Posts: 14 Joined: Fri Oct 14, 2005 7:27 am
Post
by ache » Tue Nov 01, 2005 9:15 am
Nevermind the last thing, sorted that one but got a new error.
new error:
Code: Select all
Tcl error [pub:checkgreet]: wrong # args: should be "string index string charIndex"
new code:
Code: Select all
proc pub:checkgreet {nick uhost handle channel arguments } {
list arguments $arguments
set greetnick [lindex $arguments 0]
set greetchannel [lindex $arguments 1]
set greettext [lrange $arguments 2 end]
putlog "1 Greet nick: $greetnick Greet channel: $greetchannel Greet text: $greettext"
if {([string index $greetchannel]=="#")} {
[pub:addgreet $greetnick $greetchannel $greettext]
} elseif {[string index $greetchannel]=="all"} {
[pub:addgreet $greetnick $greetchannel $greettext]
} else {
putquick "PRIVMSG $nick : Please state a channel to greet in. \026!chelp !addgreet\026 for more info."
return
}
putlog "2 Greet nick: $greetnick Greet channel: $greetchannel Greet text: $greettext"
}
proc pub:addgreet {greetnick greetchannel greettext} {
}
proc pub:delgreet {nick uhost handle channel args } {
}
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Tue Nov 01, 2005 9:37 am
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
ache
Voice
Posts: 14 Joined: Fri Oct 14, 2005 7:27 am
Post
by ache » Tue Nov 01, 2005 9:50 am
Thanks Alchera
found the problem.
ache
Voice
Posts: 14 Joined: Fri Oct 14, 2005 7:27 am
Post
by ache » Tue Nov 01, 2005 12:31 pm
Got a new problem.
this is the code so far (i know it ain´t much):
Code: Select all
proc pub:addgreet {nick greetnick greetchannel greettext} {
set greetdb "scripts/greets.db"
set greetdbtmp "scripts/greets.db.tmp"
}
Anyway. what i´m after is a process that searches a file (greets.db) for $greetchan $greetnick and if it finds it will replace it with $greetchan $greetnick $greettext. If it doesn´t find it it will just add the line at the bottom of the file.
I know this might be abit much to ask but i can´t seem to get anywhere with it.
thanks.