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.
ap
Halfop
Posts: 44 Joined: Fri Jun 09, 2006 12:20 am
Post
by ap » Sat Apr 07, 2007 12:10 pm
Hi i am using namespace but i'm missing something. I am trying to call auto:voice procedure from the main procedure "voice" but it doesn't work
Code: Select all
namespace eval test {
bind join - * [namespace current]::voice
proc voice {nick host hand chan} {
if {![isbotnick $nick] && [string equal -nocase "#test" $chan]} {
utimer 15 [list auto:voice $nick $host $hand $chan]
}
}
proc auto:voice {nick host hand chan} {
if {![botisop $chan] || [matchattr $hand b]} {return}
if {![isop $nick $chan] && ![isvoice $nick $chan]} {
pushmode $chan +v $nick
}
}
}
i get timer error plus invalid command name "auto:voice"
thanks
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Sat Apr 07, 2007 12:17 pm
The auto:voice proc is within the proc.
change:
Code: Select all
utimer 15 [list auto:voice $nick $host $hand $chan]
]
to
Code: Select all
utimer 15 [list [namespace current]::auto:voice $nick $host $hand $chan]
That should fix your problem...
r0t3n @ #r0t3n @ Quakenet
ap
Halfop
Posts: 44 Joined: Fri Jun 09, 2006 12:20 am
Post
by ap » Sat Apr 07, 2007 2:23 pm
thank you, Tosser^^
one more question please. i have noticed sometime when bot returns from netsplit etc. then utimer doesn't start unless i try .restart
any advise please?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sat Apr 07, 2007 9:40 pm
Tcl-commands.doc:
REJN (stackable)
bind rejn <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel>
Description: someone who was split has rejoined. mask can contain
wildcards, and is matched against '#channel nick!user@host'.
ap
Halfop
Posts: 44 Joined: Fri Jun 09, 2006 12:20 am
Post
by ap » Sat Apr 07, 2007 11:19 pm
thank you, Sir_Fz. But i'm confused about REJN bind, how this will fit with the following codes? i mean then when JOIN bind will start working? i'll appreciate for help, thanks
may be bind rejn - * [namespace current]::voice need to add to the following codes?
Code: Select all
namespace eval test {
bind join - * [namespace current]::voice
proc voice {nick host hand chan} {
if {![isbotnick $nick] && [string equal -nocase "#test" $chan]} {
utimer 15 [list [namespace current]::auto:voice $nick $host $hand $chan]
}
}
proc auto:voice {nick host hand chan} {
if {![botisop $chan] || [matchattr $hand b]} {return}
if {![isop $nick $chan] && ![isvoice $nick $chan]} {
pushmode $chan +v $nick
}
}
}
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Apr 08, 2007 6:01 am
REJN is triggered when someone rejoins from a netsplit, so yeah adding that bind should solve your problem.
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Sun Apr 08, 2007 1:21 pm
The rejn bind will work with the current voice proc.
Add this line:
Code: Select all
bind rejn - {*} [namespace current]::voice
under this line:
Code: Select all
bind join - * [namespace current]::voice
r0t3n @ #r0t3n @ Quakenet
ap
Halfop
Posts: 44 Joined: Fri Jun 09, 2006 12:20 am
Post
by ap » Sun Apr 08, 2007 1:42 pm
Thank you so much Tosser^^ and Sir_Fz