egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

namespace

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sat Apr 07, 2007 12:10 pm    Post subject: namespace Reply with quote

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
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Sat Apr 07, 2007 12:17 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sat Apr 07, 2007 2:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Apr 07, 2007 9:40 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sat Apr 07, 2007 11:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Apr 08, 2007 6:01 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Sun Apr 08, 2007 1:21 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sun Apr 08, 2007 1:42 pm    Post subject: Reply with quote

Thank you so much Tosser^^ and Sir_Fz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber