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.

Spurious partyline response

Old posts that have not been replied to for several years.
Locked
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Spurious partyline response

Post by arfer »

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"
}
}

Has anybody any idea as to what is causing this?
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Re: Spurious partyline response

Post by YooHoo »

arfer wrote: However the following line is seen in the bot's partyline :-

<<arfer>> !arfer! .test
...
Has anybody any idea as to what is causing this?
your console settings.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

Thanks demond. I understand. I'm assuming that deliberately ending a proc with the statement 'return 0' will do the trick
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

arfer wrote:Thanks demond. I understand. I'm assuming that deliberately ending a proc with the statement 'return 0' will do the trick
exactly
Locked