Scheduled in-game events

Posted by Inge Jones on Sat 26 Sep 2009 05:43 PM — 3 posts, 20,509 views.

#0
Ok I gave up on lambdamoo it just wasn't optimal for the game I was trying to design. I think MUSH is going to have more support for the concepts.

My question is, can someone give me an overview to the usual approach to softcode a process that runs in the game constantly and updates property values on players at, say 15 min intervals?

I don't need the coding details, I can work out language and syntax from the manual, just an overview of the general approach needed.
USA #1
I dislike an unresponded-to thread.

The best option would be probably the @wait <secs> = <do stuff> command. Expanded this would be something like:


&looper <object> = @wait [mul(<minutes>,60)] = {main script;@trigger me/looper}


However, with the latest build (1.8.4p3), you also have the option of triggering off of socket events such as @dump (via the dump`complete attribute).

Set the dump_interval in the mush.cnf file to 15 minutes, then after the database is saved, your event handler object would fire the proper script. HELP EVENTS spells this out.
Amended on Fri 08 Apr 2011 05:25 PM by Daniel P
#2
most muds have a timer mechanism:

something like:
timer.add(my event, 100sec);
and this timer is checked every (ie) 100 ms if an event should be started.

In my Mud Engine I've coupled this to lua so you can do something like this in your script:

do something
sleep(15min)
do something
sleep(2sec)
do something
etc

The engine takes care of stuff like creatures dying in the meantime (for creature scripts) etc..