Building a system: How to handle/use events

Post Reply
Parnakra
Posts: 35
Joined: Tue Apr 21, 2009 10:48 am

Building a system: How to handle/use events

Post by Parnakra »

I've set out (yet again) to build a Mudlet-system for Achaea. This time, however, I'd like to have a more organized approach, as previous attempts were just random scripting and a bunch of triggers.

The basic lay-out of the system is already there (it'll be sort-of modular), but I'm a bit at loss about how to handle/use the events-system.

Basically, I have most of the 'normal' events implemented (gained- and lostBalance (for every balance eg. balance, equilibrium, sip, etc.), gained- and lostDefence, etc.) but I'm not sure how (or to be precise, when to use them). Do I only trigger these events by triggers (basically external signals to the system), which then set things in motion in my system (checks, queues, etc.) or do I call a system function in my triggers which then does its thing and eventually raises an event (so an event is only raised if it is absolutely sure that it has happened (so I'm sure that, for example, me regaining balance wasn't an illusion).

I'd appreciate any input, maybe even a write-up of how you advanced systembuilders have done it in the past or are doing it now. Thanks!

/edit: Forgot to mention, at the moment I'm going with the triggers-raise-events model. But the reason I'm questioning this method (or my implementation of it) is that I have nothing to set it in motion. For example, if I want my auto-defup to work, I have to manually set up a single defence which causes me to lose balance and/or equilibrium and then sets the rest up automatically via events (gainedBal/lostBal).

In the past, I would've used a queue-checkerfunction at every prompt, but doing this in combination with the events seems to beg for 'concurrency' issues (variables being set/unset by the function/events that get called at different times).

Post Reply