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.
Old posts that have not been replied to for several years.
bratt
Voice
Posts: 4 Joined: Tue Jul 05, 2005 6:03 am
Post
by bratt » Tue Jul 05, 2005 6:07 am
hi need help with this script that is intent to make a bot say something in channel by using the trigger !say #chan <text>
the script seems to be bugged or has a mistake because when i do the command it says it to the channel its commanded in rather than the channel its meant to.
the auth part just means the script i have for a user to auth to be able to use the command
Code: Select all
# Says something on any channel
# Usage: !say <chan> <what>
proc pub:say {nick host hand chan arg} {
global botnick
if {![auth:check $hand]} {return 0}
if {[llength $arg] < 2} {
notice $nick "Usage: !say <chan> <what>"
return 0
}
set thechan [lindex $arg 0]
set what [lrange $arg 1 end]
if {![onchan $botnick $thechan]} {
notice $nick "I'm not on that channel."
return 0
}
puthelp "PRIVMSG $chan :$what"
notice $nick "Said to $thechan: $what"
putcmdlog "<<$nick>> !$hand! ($thechan) !say $what"
thanx in advance
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Tue Jul 05, 2005 9:32 am
However, it will exploit with braces and brackets.
Use this code instead
Code: Select all
set thechan [lindex [split $arg] 0]
set what [lrange [split $arg] 1 end]
bratt
Voice
Posts: 4 Joined: Tue Jul 05, 2005 6:03 am
Post
by bratt » Tue Jul 05, 2005 7:10 pm
cheers metroid i tried that and it seems to be doing the same
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Wed Jul 06, 2005 9:38 am
Well it shouldn't.
Maybe you forgot something, here is the fixed code:
Code: Select all
# Says something on any channel
# Usage: !say <chan> <what>
proc pub:say {nick host hand chan arg} {
global botnick
if {![auth:check $hand]} {return 0}
if {[llength $arg] < 2} {
notice $nick "Usage: !say <chan> <what>"
return 0
}
set thechan [lindex [split $arg] 0]
set what [lrange [split $arg] 1 end]
if {![onchan $botnick $thechan]} {
notice $nick "I'm not on that channel."
return 0
}
puthelp "PRIVMSG $thechan :$what"
notice $nick "Said to $thechan: $what"
putcmdlog "<<$nick>> !$hand! ($thechan) !say $what"
bratt
Voice
Posts: 4 Joined: Tue Jul 05, 2005 6:03 am
Post
by bratt » Thu Jul 07, 2005 1:43 pm
cheers