How to use events: Put this in your script: # Requires event handlers load events.irc When an event should be assigned, use ASSIGN_EVENT to assign it a number. The parameters are the handler procedure, which is called when the event takes place (this procedure/alias should expect no arguments), and after that optionally the "OK handler", a command line which should be executed if the user presses ctrl-o before the event has taken place. ASSIGN_EVENT returns a number which should be stored. It can be used to pass to DELAYIFTYPING function, which determines if the queue number is 1 and if the event should be delayed, if the user is typing something. If so, DELAYIFTYPING installs necessary handlers etc. so that the event will take place whenever user finishes typing and presses return or clear the imbut buffer (checked every 3 seconds). DELAYIFTYPING returns 1 if the event was delayed (user was typing or it was not first in queue), 0 if the event executed immediately. The handler should expect no arguments, and is otherwise a normal procedure/ alias. Remember that any call that did the assignment for an event has already finished (this might cause trouble with variables having wrong values, etc.). The last thing the handler does should be a call to the next_event procedure. (This could be automated, but there has to be _some_ indication that the handler sequence has finished (might contain hooks, timers, input, etc.) so the next_event call is a good way of marking this.) For example implementations, see the invite prompting (invprompt.irc) and dcc chat/send prompting (dccprompt.irc) scripts. Overview of functions (ROUGH old draft) assign_event(event_handler ok_handler): - increase $events - set up /on hook "wizirc event #" event_handler - set $ok_handler to ok_handler - if $events = 1, set $active_event to 1 - return $events this_event: - call /hook "wizirc event $active_event" next_event: - set $active_event to $active_event+1 - call this_event clear_events: resets event queue: - set $events to 0 - set $active_event to 0 - clear $ok_handler - clear /on hook "wizirc event" - (if possible?) - set up again /on hook "wizirc event %" clear_events - set up again /on hook "wizirc event ok" ok_last_event ok_last_event: - clear the last event /on hook "wizirc event $events" - - decrease $events - call current $ok_handler (process as "yes" or other appropriate answer) - clear $ok_handler Set up initially: clear_events bind ^O on hook "$event_id %" on hook "$event_id ok"