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.

can't get the usercount in channel

Old posts that have not been replied to for several years.
Locked
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

can't get the usercount in channel

Post by eiSi »

hi there!

my problem: the bot doesn't get the usercount in a channel.

my code:

set defchanoptions {
chanmode "+t"
idle-kick 0
need-op { }
need-invite { }
need-key { }
need-unban { }
need-limit { }
flood-chan 30:60
flood-deop 10:10
flood-kick 10:10
flood-join 10:60
flood-ctcp 10:60
}

...
channel add $channel $defchanoptions
savechannels
set chancount [llength [chanlist $channel]]
channel remove $channel
savechannels
notice $nick $chancount
...

($channel is for example "#mychan")

the bot also says: joined #mychanbut didn't want to!

so, what can I do for this to work?

thanks for any help!
Greetz,
eiSi
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The code seems to be correct.. this sounds like an net-type wrong setting. Review it and change as suits the server he is running better.
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

No, this is the speed of your script, and parts need to be delayed.

You are adding a channel, getting a channel count and them removing it, all wihtin the one script cycle.

1: Adding channels.

Eggdrop will add the channel and the settings to its internal records and then send the "JOIN #channel" command.

2: Getting channel count.

This is where you bot is stuck. When you join a channel, any clinet including eggdrop, will download a list of the users in the channel, the ban list, channel modes and the topic.

The problem here, eggdrop is in the middle of a script, and can't parse this incoming data, thus doesn't have it on record.

3: Remove channel

As above, eggdrop has not yet parsed the incoming data fromt he server, because it is stuck in a script.

This command removes any information stored in memory about the channel, and then sends a "PART #channel" message to the server.

The reason you get the "Join but didn't want to", is because of this incoming data that is waiting. Once the above script has finished, the bot will parse this data. The data shows a channel it doesn't know about (more like no longer knows about), so it displays that message.

There is only one way around this. Delay obtaining a channel count, and delete the channel then.

This can be done somthing like this

Code: Select all

proc delaychancount {nick chan} {
  get count [llength [chanlist $chan]]
  channel remove $chan
  notice $nick $count
}
You can now remove the lines that get the count, send the message and remove the channel, from your script, and replace them with 1 single line

Code: Select all

utimer 5 [list delatchancount $nick $channel]
This will use a timer to delay the count and removal, allowing eggdrop tiem to parse the script (so long as another script doesn't take too much time).
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Uhhm.. yes, ignore my previous post.. This seems to be one a bad day..
Once the game is over, the king and the pawn go back in the same box.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

thx ppslim for this detailed answer!
it all works fine now!

but caesar, also thank you :)
Locked