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.

User specific timer

Help for those learning Tcl or writing their own scripts.
Post Reply
j
joke
Voice
Posts: 13
Joined: Fri Aug 19, 2005 7:20 am
Location: Karlsruhe
Contact:

User specific timer

Post by joke »

Hi!

I want to write a script which post a helpline to a user on demand. To simplify the problem the helpline should only be "HELP", command should be !help.

But now my two problems: at first I need a timer which allows only one request per minute PER USER.

My second problem is, that in reality the helpline is not one line but something about 15 lines. When 2 users make a request at the same time, the 2nd user has to wait. Is there a commandto tell the bot to make 2 outputs at the same time?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Problem #1:
Since you say "user", I assume they're added to your bot's userlist.
In this case, I'd just use an XTRA-field (setuser <handle> XTRA help-last [unixtime]) to store a timestamp, and then compare it whenever a user calls your help-command (getuser <handle> XTRA)

Problem #2:
This is usually more a server-limitation, as ircd's generally has a throttling control to prevent flooding. Eggdrop uses several different queues and keeps track of "punishment points" in order to avoid beeing flooded off.
These queues have different priorities and are generally fifo (first in, first out).
At the same time, tcl is generally not multithreaded, specifically; only one command will be executed at a time in an interpreter (hence if you call a proc, it will run to the end before anything else can be called). So unless you wish to create 14 timers for each time an user types !help, you'll have to live with that...
NML_375
Post Reply