| View previous topic :: View next topic |
| Author |
Message |
ap Halfop
Joined: 09 Jun 2006 Posts: 44
|
Posted: Sat Apr 07, 2007 12:10 pm Post subject: namespace |
|
|
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: | 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 |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Sat Apr 07, 2007 12:17 pm Post subject: |
|
|
The auto:voice proc is within the proc.
change:
| Code: | | utimer 15 [list auto:voice $nick $host $hand $chan] | ]
to
| Code: | | utimer 15 [list [namespace current]::auto:voice $nick $host $hand $chan] |
That should fix your problem... _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
ap Halfop
Joined: 09 Jun 2006 Posts: 44
|
Posted: Sat Apr 07, 2007 2:23 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Apr 07, 2007 9:40 pm Post subject: |
|
|
Tcl-commands.doc:
| Quote: | 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'. |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
ap Halfop
Joined: 09 Jun 2006 Posts: 44
|
Posted: Sat Apr 07, 2007 11:19 pm Post subject: |
|
|
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: | 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
}
}
} |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Apr 08, 2007 6:01 am Post subject: |
|
|
REJN is triggered when someone rejoins from a netsplit, so yeah adding that bind should solve your problem. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Sun Apr 08, 2007 1:21 pm Post subject: |
|
|
The rejn bind will work with the current voice proc.
Add this line:
| Code: | | bind rejn - {*} [namespace current]::voice |
under this line:
| Code: | | bind join - * [namespace current]::voice |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
ap Halfop
Joined: 09 Jun 2006 Posts: 44
|
Posted: Sun Apr 08, 2007 1:42 pm Post subject: |
|
|
| Thank you so much Tosser^^ and Sir_Fz |
|
| Back to top |
|
 |
|