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.

simple tcl on join/part/quit script

Old posts that have not been replied to for several years.
Locked
b
blackwidow

Post by blackwidow »

I need a simple script that will write the number of users in a channel to a mySQL table. I think I'll use mytcl to make things easier. That leaves a small script that should run on join/part/quict/kick and update the mysql table using "sql query $handle $query".

I've never touched tcl before, so I'm going to give it a try just to see what happens. The mySQL query is no problem. If anyone has a script or example that could help me out here, it would be quite appreciated. Thanks.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You will find almost all the information you need in the tcl-commands.doc file that accompanies eggdrop. To react to joins, try the following:

Code: Select all

bind join - * join_handler

proc join_handler {nick uhost hand chan} {
  # Do whatever you want here
}
The section on binds is about halfway through, labeled "COMMAND EXTENSION".
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

I sugest mysqltcl rather than mytcl.

It provides a builtin escape function, and can tell you if a previous connection to the server died, or is invalid. This is not possible tiwht mytcl, which will just error out.
b
blackwidow

Post by blackwidow »

thanks, I'll give that a try. is the easiest way to get the number of users in a channel to use chanlist and count?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

the simplest method is to
set users_in_chan [llength [chanlist #channame]]
Locked