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.

Telnet Commands

Help for those learning Tcl or writing their own scripts.
Post Reply
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

Telnet Commands

Post by Branden »

How can I have the bot execute commands such as REHASH and RESTART via public chat commands?
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

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
#Quiz.de @ irc.GameSurge.net
JavaChat
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

Post by Branden »

Thank you so much! :D
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

Post by Branden »

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"
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Read Tcl-commands.doc about the newexempt, newchanexempt, newinvite, and newchaninvite commands.
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

Post by Branden »

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?"
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

?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
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

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.
Post Reply