I have an oddity with one of my own scripts. An oddity because, whilst there are no errors, there is a spurious message in the partyline upon activating a public command trigger. I have set up the following otherwise meaningless script to demonstrate.
set playing 0
bind PUB -|- .test pTestProc
proc pTestProc {nick uhost hand chan arg} {
global playing
if {$playing == 0} {
putserv "PRIVMSG $chan :$playing"
}
set varDummy 10
}
After typing .test in an irc channel using my usual nick of 'arfer', the script duly responds with 0 in the same channel. However the following line is seen in the bot's partyline :-
<<arfer>> !arfer! .test
If I change the script slightly (in fact order the lines a little differently) as below, the script functions in precisely the same manner but there is no spurious partyline message.
set playing 0
bind PUB -|- .test pTestProc
proc pTestProc {nick uhost hand chan arg} {
global playing
set varDummy 10
if {$playing == 0} {
putserv "PRIVMSG $chan :$playing"
}
}
that "spurious" line is actually a log message from the [bind pub] proc
a PUB bind logs the public command that has triggered it if the handler proc returns 1 (or rather non-zero) - and in the first case your proc implicitly returns non-zero, because the last operation is [set] with a positive number
in the second case, you moved that [set] and your proc no longer returns implicitly non-zero - in the absence of last operation that implicitly changes the return value, zero is returned by default and the public command doesn't get logged