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.

Binding Twice

Old posts that have not been replied to for several years.
Locked
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Binding Twice

Post by Weirdo »

Code: Select all

bind join - "$irpg(runchan)*" join:login
proc join:login {nick uhost hand chan} {
        global irpg
        if {$nick == $::botnick} {
                putlog "\002Joined #irpg\002 - $chan $nick"
                puthelp "Privmsg $irpg(bot) :login $irpg(name) $irpg(pass)"
                }
}
I have a slight problem. I want this little bit of script to trigger when the bot joins a channel, #irpg. the bot does join it, but then the if statement runs twice, giving me two messages and sending the pm twice.

<Natsuki-Chan> [12:24] Joined #pirg - #irpg Natsuki-Chan
<Natsuki-Chan> [12:24] Joined #irpg - #irpg Natsuki-Chan


Secondly, this doesnt bind at all... when the nickname matching $irpg(bot) joins the channel.

Code: Select all

        if {$nick == $irpg(bot)} {
                putlog "$irpg(bot) joined channel, sending message"
                puthelp "Privmsg $irpg(bot) :login $irpg(name) $irpg(pass)"
                }


Can you help, as i can gaurentee its something most likely blatantly simple, that i am missing

Thanks
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

Code: Select all

bind join - "$irpg(runchan)*" join:login 
proc join:login {nick uhost hand chan} { 
  global irpg botnick
  if {[string match -nocase $botnick $nick]} { 
    putlog "\002Joined #irpg\002 - $chan $nick" 
    putserv "PRIVMSG $irpg(bot) :login $irpg(name) $irpg(pass)" 
  } 
}
didn't test it tho

also if its to identify to nickserv plz check the tclarchive there are allready scripts in there that do this .. then use bind notice or if its on connect then check out bind evnt
XplaiN but think of me as stupid
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Its actually for an rpg channel i frequent in :)

What i am mostly concerned about is why the bind doesnt trigger. IE, when the nickname in question rejoined the channel ater a netsplit, nothing happened. When i would expect it to happen. A string match is always an alternative. Although from what i could tell, the nickanem i specified in the $irpg(bot) was IDENTICAL to the nickname that joined.

Which is why i am a little confuzzled
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

Code: Select all

bind join - "$irpg(runchan)*" join:login 
set that to

Code: Select all

bind join - * join:login
* = host mask not the channel it is joining

add this

Code: Select all

if {[string match -nocase $irpg(runchan) $chan]} {

# put here the content of ur current proc

} 
or set

Code: Select all

bind join - "$irpg(runchan)*" join:login 
to

Code: Select all

bind join - "ident@host.tld" join:login 
of your bot eh

maybe also change

Code: Select all

if {[string match -nocase $botnick $nick]} {
to

Code: Select all

if {[isbotnick $nick]} {
then you can remove global as well
XplaiN but think of me as stupid
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

This is the code in the end. I know itll work, but i have yet to see if itll stop the double binds. As my usual irc network is fux0red

Code: Select all

#Triggers when the bot joins the channel
bind join - * join:login
proc join:login {nick uhost hand chan} {
        global irpg
        if {[string match -nocase $irpg(runchan) $chan]} {
                if {[isbotnick $nick]} {
                        putlog "\002Joined #irpg\002 - $chan $nick"
                        puthelp "Privmsg $irpg(bot) :login $irpg(name) $irpg(pa$
                        } {
                        if {[string match -nocase $irpg(bot) $nick]} {
                                putlog "$irpg(bot) joined channel, sending mess$
                                puthelp "Privmsg $irpg(bot) :login $irpg(name) $
                                } { return 0 }
                        }
                }
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

what are u talking about ?

no genius talk just plain english ;)
XplaiN but think of me as stupid
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

What was happening is that because i kept changing the binds, the old binds were not being removed. I try to avoid restarting the bot as often as possible as it [censored] a few things up. But the double (and ended up as tripe) binding was due to the old binds not being removed.

fixed by restarting

Is there an easier way to refresh the binds list without rebooting the bot?

the script works fine btw
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

type .binds in party line then unbind every bind u don't like using .tcl unbind bindname

also if u remove the binds and rehash the bots then the binds should be overwritten so .. and it should work just fine ..
XplaiN but think of me as stupid
Locked