| View previous topic :: View next topic |
| Author |
Message |
everythingdaniel Voice
Joined: 17 Aug 2009 Posts: 8
|
Posted: Tue Aug 18, 2009 6:40 pm Post subject: On Part not working |
|
|
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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Aug 18, 2009 6:48 pm Post subject: |
|
|
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 |
|
 |
everythingdaniel Voice
Joined: 17 Aug 2009 Posts: 8
|
Posted: Tue Aug 18, 2009 7:56 pm Post subject: |
|
|
| Thanks for the reply! But the PART part still does not work. |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Aug 18, 2009 8:33 pm Post subject: |
|
|
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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Wed Aug 19, 2009 6:00 pm Post subject: |
|
|
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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Sat Aug 22, 2009 10:57 am Post subject: |
|
|
| 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 |
|
 |
|