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.

Statistics.tcl by perpleXa (the pubm problem)

Support & discussion of released scripts, and announcements of new releases.
Post Reply
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Statistics.tcl by perpleXa (the pubm problem)

Post by willyw »

Hello,
I hope this is the right place for this.

This is about Statistics.tcl by perplexa.
Can be found here: http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1079


Discovered that scripts can cause channel monitoring via console with +p flag, and channel logging of all traffic with the +p flag, can be interferred with (stopped) by some scripts.

I do not know .tcl scripting myself.

Inititally found mention of the problem here: http://forum.egghelp.org/viewtopic.php? ... el+message
see the post(s) by nml375 Posted: Tue Dec 12, 2006

I found that xchannel will cause it.

Then, stumbled into some help with it here:
http://forum.egghelp.org/viewtopic.php?p=86959#86959
I'd actually given up on it, since I can't work on it myself.
This was sort of accidental in this thread. (much thanks to "user"!")

Now I have discovered the same problem again, with Statistics.tcl by perplexa.
If I simply shut it off via .chanset, then console viewing of the channel traffic returns. I'm sure it is the Statistics.tcl script.

Would anyone that knows .tcl be able to look at the Statistics script and let me know if it is fixable (without causing other problems) ?
and if so, how and where to edit it?

Thanks
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

if {(![channel get $channel stat])} {
   return 0
}
Basically, if the channel isn't set +stat a return of 0 is issued. This is the problem with returning values (in this case a zero, 0) from procedures that are triggered by binds. Change it to merely a 'return'. And by the looks of skimming through that script, every single 'return 0' can be changed safely to 'return'. This should undo the "trapping" the script was doing.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

speechles wrote:

Code: Select all

if {(![channel get $channel stat])} {
   return 0
}
Basically, if the channel isn't set +stat a return of 0 is issued. This is the problem with returning values (in this case a zero, 0) from procedures that are triggered by binds. Change it to merely a 'return'. And by the looks of skimming through that script, every single 'return 0' can be changed safely to 'return'. This should undo the "trapping" the script was doing.
Thank you for replying.

I am a bit confused though. From what I previously read here:
http://forum.egghelp.org/viewtopic.php?p=86959#86959
"return 0" IS what is needed.

But, as an experiment anyway, I have tried what you suggested.
I edited the .tcl script.
Text searched for 'return 0' , and changed every instance to simply 'return' .

Loaded bot.
With .chanset -stat , +p in console and I can monitor traffic in the channel, same as before.
With .chanset +stat , and still +p in console, I cannot... same as before

In other words, no change. :( Editing the 'return 0' instances to 'return' did not fix it.

I do appreciate your time in this though. Or anyone else that can comment here and help, as I'd like to get this script fixed.

Do you (or anyone else) have further suggestions for me to try next?

Thanks
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

tcl-commands.doc:

Code: Select all

    (6)  PUBM (stackable)
         bind pubm <flags> <mask> <proc>
         procname <nick> <user@host> <handle> <channel> <text>

         Description: just like MSGM, except it's triggered by things said
           on a channel instead of things /msg'd to the bot. The mask is
           matched against the channel name followed by the text and can
|          contain wildcards. If the proc returns 1, Eggdrop will not log
|          the message that triggered this bind.
Returning 0 is the right thing to do. There must be some procs returning something else... What commands are not being logged? Try all commands, note which ones prevent logging, look up the bind (in the top of the script), find the proc triggered by the bind and take a look at the end of the proc (if you don't invoke "return", the value returned by the last command invoked will be returned - which can be pretty unpredictable in some cases)
Have you ever read "The Manual"?
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

user wrote:tcl-commands.doc:

Code: Select all

    (6)  PUBM (stackable)
         bind pubm <flags> <mask> <proc>
         procname <nick> <user@host> <handle> <channel> <text>

         Description: just like MSGM, except it's triggered by things said
           on a channel instead of things /msg'd to the bot. The mask is
           matched against the channel name followed by the text and can
|          contain wildcards. If the proc returns 1, Eggdrop will not log
|          the message that triggered this bind.
Returning 0 is the right thing to do. There must be some procs returning something else... What commands are not being logged? Try all commands, note which ones prevent logging, look up the bind (in the top of the script), find the proc triggered by the bind and take a look at the end of the proc (if you don't invoke "return", the value returned by the last command invoked will be returned - which can be pretty unpredictable in some cases)
Thank you for the reply.

Commands not being logged? I don't understand the question. Sorry.

Perhaps I've not explained the problem and symptoms.
I have a script that I want to use.
When I enable it, logging of regular messages in the channel to the channel log ceases.
Further, I can no longer see regular channel messages from within the partyline.
For channel logging, I do have the +p flag set
For channel monitoring via the partyline, I do have the +p flag set in console.
Both channel monitoring and logging work, when that script is disabled.
Both stop as soon as the script is enabled.
It is not that some commands are not being logged... EVERYTHING is not being logged.

The script in question is already mentioned in my first post. I didn't think I should try to post the whole script in here.
Should I?


I did find this, in the top of the script:

Code: Select all

bind PUB   -|-  ${trigger}stat   [namespace current]::spew
  bind PUB   -|-  ${trigger}top10  [namespace current]::toplist
  bind PUB   -|-  ${trigger}top20  [namespace current]::toplist
  bind PUBM  -|-  *                [namespace current]::monitor
  bind CTCP  -|-  ACTION           [namespace current]::ctcp
  bind EVNT  -|-  save             [namespace current]::save
  bind TIME  -|-  {00 * * * *}     [namespace current]::cleanupdb
if that has meaning to you.
I can see what you mentioned... the bind PUBM part , but I don't know what to do with it or how to interpret it. Sorry.
Does the asterisk mean that this script reacts to everything? (sorry if that sounds dumb)

Regarding the proc s throughout the rest of the script, I do see that some of them include a line "return 0" at the end of them.

But some do not.
Some seem to have specific values in the "return".
Could a "return 0" be added as the last line in the proc , without upsetting the operation of the script?

Text searching the script for "return" and ignoring all the "return 0" found,
I find:

Code: Select all

    return "\[Top$number $type - No valuable information available for \002$channel\002\]"

and

return $output

and

return $killed

and

return $i

and

return $num\.0

and

return [expr {($secondary == 10) ? ($primary+1.0) : "$primary.$secondary"}]


at various places in the script
I guess you'd have to look at the script... I'm not doing a very good job of explaining it, I'm afraid.


Thank you for looking at this with me.
User avatar
bayo
Voice
Posts: 15
Joined: Tue Jan 25, 2022 4:14 pm
Location: Bulgaria
Contact:

Re: Statistics.tcl by perpleXa (the pubm problem)

Post by bayo »

Hello guys, to bring the topic back to life, I'm experiencing issues with the script and it doesn't seems to have a new, updated version so I'll ask here if possible. The question is how we can fix some of the triggers so they can work again.

Code: Select all

variable statistics
    array set statistics {
        storage {scripts/stats/statistics1en.txt}
        todaystorage {scripts/stats/tdaystatistics.txt}
        allbinds {all}
        helpbinds {shelp}
        topbinds {top}
        statbinds {stat}
        placebinds {place}
        todaytopbinds {ttop}
        todaystatbinds {tstat}
        todayplacebinds {tplace}
!all {all} works

!top {top} and !ttop {ttop} doesn't work with error showing :

Code: Select all

[21:50:04] Tcl error [::statistics::totaltop]: element 1 missing from sublist " 0"
.set errorInfo
[21:51:06] #BAYO# set errorInfo
Currently: element 1 missing from sublist " 0"
Currently:     while executing
Currently: "lsort -integer -increasing -index 1 $toplist"
Currently:     (procedure "::statistics::top" line 93)
Currently:     invoked from within
Currently: "::statistics::top $nickname $hostname $handle $channel $arguments total"
Currently:     (procedure "::statistics::totaltop" line 2)
Currently:     invoked from within
Currently: "::statistics::totaltop $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
!stat {stat} works

!place {place} and !tplace {tplace} doesn't work with error showing:

Code: Select all

[21:53:51] Tcl error [::statistics::totalplace]: element 1 missing from sublist " 0"
.set errorInfo
[21:54:18] #BAYO# set errorInfo
Currently: element 1 missing from sublist " 0"
Currently:     while executing
Currently: "lsort -integer -increasing -index 1 $toplist"
Currently:     (procedure "::statistics::place" line 91)
Currently:     invoked from within
Currently: "::statistics::place $nickname $hostname $handle $channel $arguments total"
Currently:     (procedure "::statistics::totalplace" line 2)
Currently:     invoked from within
Currently: "::statistics::totalplace $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
!tstat {tstat} works.

Is there any chance this can be fixed? I can provide the whole code if you say so.
User avatar
CrazyCat
Revered One
Posts: 1301
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: Statistics.tcl by perpleXa (the pubm problem)

Post by CrazyCat »

I had a look to the script I found @ tclarchive (version 1.0.2). None of the erroreous proc are in it, so share your actual script to let us help you.

I've a small idea but can't confirm without the script
User avatar
bayo
Voice
Posts: 15
Joined: Tue Jan 25, 2022 4:14 pm
Location: Bulgaria
Contact:

Re: Statistics.tcl by perpleXa (the pubm problem)

Post by bayo »

Wonderful! I must say I'll have to add it on a seperate paste link as the forum says "Your message contains 76915 characters.
The maximum number of allowed characters is 60000.
"

Meanwhile, I'll check the old version and see how it behaves. Until then, I'm posting the link code below. Good luck!!!

https://paste.ec/paste/7te9nkOM#hm4gF5A ... iOiuZZ9fZ6
User avatar
CrazyCat
Revered One
Posts: 1301
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: Statistics.tcl by perpleXa (the pubm problem)

Post by CrazyCat »

Well, I tested the script you provided:

Code: Select all

15:58:29 <@CrazyCat> Ne vous taisez pas, je fais un test et j'ai besoin d'activité
15:59:37 <@CrazyCat> !top
15:59:37 <Jarvis> Top 10 by "words": #1 - CrazyCat(13/100.00%).
16:01:36 <@CrazyCat> !place
16:01:38 <Jarvis> CrazyCat takes 1 place of 1 by "words" (14) in channel #eggdrop for all time.
also tested with !tplace and !tplace lines and I hadn't any error.

I'll let the script running a few time to check if it occures later.
User avatar
aslpls
Halfop
Posts: 47
Joined: Mon May 02, 2016 9:41 am

Re: Statistics.tcl by perpleXa (the pubm problem)

Post by aslpls »

hi all, I've tested the script also and it seem work well. All the commands working with no error.
I am using eggdrop 1.6.21 ..
It was FUNNY!
Post Reply