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.
Branden
Halfop
Posts: 61 Joined: Sat Aug 04, 2007 8:36 pm
Post
by Branden » Sat Mar 22, 2008 6:30 pm
How can I have the bot execute commands such as REHASH and RESTART via public chat commands?
tueb
Halfop
Posts: 76 Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:
Post
by tueb » Sat Mar 22, 2008 7:45 pm
Code: Select all
bind pub -|- !restart restart:reply
bind pub -|- !rehash rehash:reply
proc restart:reply {nick host handle channel text} {
if {![isop $nick $channel]} {
return
}
restart
}
proc rehash:reply {nick host handle channel text} {
if {![isop $nick $channel]} {
return
}
rehash
}
this will allow ops to use !restart and !rehash
tueb
Branden
Halfop
Posts: 61 Joined: Sat Aug 04, 2007 8:36 pm
Post
by Branden » Sat Mar 22, 2008 7:49 pm
Thank you so much!
Branden
Halfop
Posts: 61 Joined: Sat Aug 04, 2007 8:36 pm
Post
by Branden » Sat Mar 22, 2008 8:08 pm
I'm having a little problem with the +exempt and +invite:
Script:
Code: Select all
bind pub o|o "@e" exempt
bind pub o|o "@I" invite
proc exempt { nick host hand chan text } {
set whom [lindex $text 0]
set howlong [lindex $text 1]
+exempt $whom $chan $howlong
stick exempt $whom
}
proc invite { nick host hand chan text } {
set whom [lindex $text 0]
set howlong [lindex $text 1]
+invite $whom $chan $howlong
stick exempt $whom
}
Error:
Code: Select all
[20:05] Tcl error [exempt]: invalid command name "+exempt"
[20:09] Tcl error [invite]: invalid command name "+invite"
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sat Mar 22, 2008 9:15 pm
Read Tcl-commands.doc about the newexempt, newchanexempt, newinvite, and newchaninvite commands.
Branden
Halfop
Posts: 61 Joined: Sat Aug 04, 2007 8:36 pm
Post
by Branden » Sun Mar 23, 2008 5:41 am
Ok, thanks.
I read it, and I'm getting errors.
Code:
Code: Select all
bind pub o|o "@e" exempt
bind pub o|o "@I" invite
proc exempt { nick host hand chan text creator ?liftime? ?options? } {
set whom [lindex $text 0]
set howlong [lindex $text 1]
newchanexempt $chan $whom $nick ?lifetime? 0 ?options? sticky
}
proc invite { nick host hand chan text creator ?liftime? ?options? } {
set whom [lindex $text 0]
set howlong [lindex $text 1]
newchaninvite $chan $whom $nick ?lifetime? 0 ?options? sticky
}
Errors:
Code: Select all
[05:42] Tcl error [exempt]: wrong # args: should be "exempt nick host hand chan text creator ?liftime? ?options?"
[05:44] Tcl error [invite]: wrong # args: should be "invite nick host hand chan text creator ?liftime? ?options?"
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Mar 23, 2008 7:15 am
?lifetime? and ?option? are optional settings (hence the '?'), you either add a lifetime (a valid number) and an option (sticky) or you don't. So you should use
Code: Select all
newchanexempt $chan $whom $nick 0 sticky
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Sun Mar 23, 2008 10:06 am
The problem is in your procedure header declarations...
Pub binds are called with only "nick host hand chan text" arguments.
You cannot simply write what you want Tcl to do automatically, expecting it to work. See tcl-commands.doc that come with eggdrop, re: binds, and the arguments that those binds are called with. Also note, that variable referencing is done with a $ in front of the variable name.