Uploaded: 25 Mar, 2011
Previous uploads by this submitter: 0

Author: Plamen Arnaudov

Downloads: 79

Delay timers allow players to set up macros/aliases like 'sleep;wait 10;wake'.

This feature is typically left to MUD clients, but in my case (and maybe in yours, as well) there's a lot to be gained from implementing it on the server. The obvious advantage is that the feature becomes instantly available to everyone, regardless of their client of choice. Even users of advanced MUD clients don't always have access to one, and that's when server-side advanced usability features can shine.

The code modifies 4 core files: structs.h, comm.c, handler.c, and interpreter.c.

v1.0 supports unlimited delayed macros with multiple 'wait' instructions of up to 3600 seconds (1 hour) each. You can add your own limitations.

Note: In this implementation, delay timers continue to decrement and will run even on linkless chars. This is done so players can use them to time game events (intervals) even if they have to disconnect in between. You can change this approach by skipping over linkless chars in process_timer_queues(). And if you move the stuff from extract_char in handler.c to flush_queues in comm.c, then timers will be flushed each time a char disconnects.

This code has been tested for 2 days in a production environment. That said, it comes with no warranty whatsoever. Use the provided helper code to debug.

Enjoy, and let me know if you found this useful. Also let me know if you made tweaks to improve upon this solution.