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 

On Part not working

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


Joined: 17 Aug 2009
Posts: 8

PostPosted: Tue Aug 18, 2009 6:40 pm    Post subject: On Part not working Reply with quote

Hi, I have the below code that posts if a user leaves or joins a channel. The only problem is that it works fine on a join, but on a part it does nothing. Any ideas?


Code:

bind JOIN - * joinr
bind PART - * partr

proc joinr {jnick jhost jhandle jchannel} {
      putserv "PRIVMSG #AR_Staff :\002\00303$jnick joined $jchannel" 
}

proc partr {pnick phost phandle pchannel} {
      putserv "PRIVMSG #AR_Staff :\002\00304$pnick left $pchannel" 
}
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Tue Aug 18, 2009 6:48 pm    Post subject: Reply with quote

A part bind passes 5 arguments to the proc it calls. You only had 4. Always check the syntax in tcl-commands.html before you use a bind that you are unfamiliar with. It is also always a good idea to keep track of what's going on in the partyline while a new script is being executed, I'm pretty sure you would have seen an error telling you what was wrong.

Code:

bind JOIN - * joinr
bind PART - * partr

proc joinr {jnick jhost jhandle jchannel} {
      putserv "PRIVMSG #AR_Staff :\002\00303$jnick joined $jchannel" 
}

proc partr {pnick phost phandle pchannel pmsg} {
      putserv "PRIVMSG #AR_Staff :\002\00304$pnick left $pchannel" 
}

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
everythingdaniel
Voice


Joined: 17 Aug 2009
Posts: 8

PostPosted: Tue Aug 18, 2009 7:56 pm    Post subject: Reply with quote

Thanks for the reply! But the PART part still does not work.
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Tue Aug 18, 2009 8:33 pm    Post subject: Reply with quote

I see nothing else wrong.

Don't forget that a PART bind triggers only for users leaving a channel and not for those quitting (SIGN bind) or those split from your server (SPLT bind).
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Wed Aug 19, 2009 6:00 pm    Post subject: Reply with quote

Another note on the subject.

A PART bind does NOT seem to trigger if the bot parts, unlike a JOIN bind which does trigger if the bot joins. This was news to me until I just experimented on another script I am coding.
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Sat Aug 22, 2009 10:57 am    Post subject: Reply with quote

Code:

# report.tcl

# set here the channel the bot reports joins/parts to
set vReportChan #eggtcl

bind JOIN - * pReportJoin
bind RAW - PART pReportPart

proc pReportJoin {nick uhost hand chan} {
    global vReportChan
    if {[botonchan $vReportChan]} {
        putserv "PRIVMSG $vReportChan :\002\00303$nick joined $chan\003\002"
    }
    return 0
}

proc pReportPart {from keyword text} {
    global vReportChan
    if {[botonchan $vReportChan]} {
      set nick [lindex [split $from !] 0]
      set chan [string trim [lindex [split $text :] 0]]
      putserv "PRIVMSG $vReportChan :\002\00304$nick parted $chan\003\002"
    }
    return 0
}

putlog "report.tcl loaded"

# eof


The above script has been tested and works using a RAW bind with keyword PART instead of a PART bind. As already stated, NOT for quits, splits, kicks etc.

I have still not got to the bottom of the PART bind. I have a Windrop 1.6.19 for which the PART bind does not trigger for the bot itself parting and I have an Eggdrop 1.6.19+ctcpfix for which the PART bind does trigger. The mind boggles!
_________________
I must have had nothing to do
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