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.

Internal userlist and .rehash

Old posts that have not been replied to for several years.
Locked
J
JamesOff

Internal userlist and .rehash

Post by JamesOff »

Hi folks :)

I've been trying to get chanlist and matchattr working for like the last hour, and I think I've cracked why they were behaving erratically... .rehash seems to clear eggdrop's internal userlist, breaking chanlist and matchattr so the only users they can match is anyone who talks (so that the bot can get their hostmask etc).

I've fixed it during debugging by doing a .channel for the channel i'm working in after I do a .rehash, but is there any way of programatically making the bot update? Can I push a WHO :#channel at the server from my script and eggdrop'll catch the reply?

Thanks in advance for any help :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This will not cause matchattr to break, as it is unrelated to the channels userlist.

Matchattr is used to see if a handle matches certain flags (not channal modes like +o or +v).

The only reason matchattr would not work, is if chanlist is feeding the wrong information to it.

As such, it would be wise to post at least the non-functioning part of the script, to see if there are nay issues.

You should make sure you post includes where a variable is set.

EG
chanlist $chan

Show where the variable $chan is set.

What sort of debugging lines have you used?
Have you tried using "putlog [chanlist]" to check the output is there?
J
JamesOff

Post by JamesOff »

Here's the code that does it:

Code: Select all

proc bMotionChooseRandomBot { channel } {
  putloglev 1 * "bMotion: checking $channel"
  global botnick
  set bots [chanlist $channel]
  set botslist [list]
  foreach bot $bots {
    set handle [nick2hand $bot $channel]
    putloglev 1 * "bMotion: checking $bot ($handle)"
    if [matchattr [nick2hand $bot $channel] b&K $channel] {
      lappend botslist $bot
    }
  }
  set bots $botslist
  putloglev 1 * "bMotion: found [llength $bots] bots in $channel, $bots"
  if {[llength $bots] == 0} {
    return ""
  }

  set rbot $botnick
  while {$rbot == $botnick} {
    set rbot [lindex $bots [rand [llength $bots]]]
  }
  return $rbot
}
Before anyone has a go at me for messy code or anything, it was a lot cleaner before I started throwing debug stuff in :P

Indeed, it was just pretty much [chanlist $channel b&K] when I started :)

The output from this immediately after a .rehash is:

Code: Select all

[14:11] bMotion: checking #___
[14:11] bMotion: checking NoTopic (*)
[14:11] bMotion: checking JamesOff (JamesOff)
[14:11] bMotion: checking MonicaOff (*)
[14:11] bMotion: checking KipAway (*)
[14:11] bMotion: found 0 bots in #___,
If I do a .channel and run the code again:

Code: Select all

[14:12] bMotion: checking #___
[14:12] bMotion: checking NoTopic (NoTopic)
[14:12] bMotion: checking JamesOff (JamesOff)
[14:12] bMotion: checking MonicaOff (MonicaOff)
[14:12] bMotion: checking KipAway (TurboKip)
[14:12] bMotion: found 1 bots in #___, MonicaOff
(Which is right, Monica's the bot I wanted it to find.)

Since this definitely seems to be the cause of the problem, I'll switch it all back to [chanlist $channel b|K] I think.

My investigations did include a putlog [chanlist $channel] and far too many .tcl putlog's from the bot, like this:

Code: Select all

.rehash
<snip>
.tcl putlog [chanlist #___]
[14:16] NoTopic JamesOff MonicaOff KipAway
.tcl putlog [chanlist #___b]
<nothing>
.channel #___
<snip>
.tcl putlog [chanlist #___ b]
[14:18] NoTopic MonicaOff
The problem is DEFINITELY .rehash screwing up the internal list chanlist uses :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Well - It all sugests you are right.

There are 2 things you can do now.

1: Make sure your using the latest stable release, and then submit a bug report to the bugs address bugs@eggheads.org

2: Download, and try the CVS version, to see if this has been fixed.
J
JamesOff

Post by JamesOff »

Cool... well know I know how to work round it, I'll put up with it and try CVS and stuff when I get the chance :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Regardless, this should be tested, and fixed.

Finding issues, and just using a plain workaround will not do this.

By all means, use a workaround, but also notify people there is an issue.
Locked