Color Guide:
Red indicates a command (or commands) you enter into the MUCK.
Navy indicates text returned by the MUCK, usually a result of a command you typed.


MUF: Random Environment Effects

Here's a couple of simple programs that can be used to generate a random event after someone has arrived or looked at a room. The programs are fairly simple in themselves, but the problem has some unique challenges. I wanted the random event to appear at some time after all the room stuff has been displayed, to create the illusion of some spoofed event, but it needed to be triggered by the 'look' at the room. That ruled out various MPI solutions that would add the event to the tail end of the room's description.

What I did was create a program that could be triggered by a standard MPI function within a room description. This program's only purpose in life is to spawn another program that will display the event, placing it in the muck's event queue to run at some later time. The idea is to allow enough time for the room's description to display to the user, then follow it up with another program that displays an event, much like a spoof.

The second program's job is to find and display the random event. Since these things get obnoxious if they happen too much, I included provisions for a percent chance that an event will happen. To make the program more useful, it is built so that the events can be pulled in from an environment room somewhere up the environment tree if not locally present. You still have to trigger the event from the local description.

Here are the two programs necessary to try this: To use QueueIt, simply include the following MPI somewhere in your room's description: {muf:#1234,3 #5678}. For example: Most of my rooms have descriptions based on a property list, and I like to include this MPI as the last property in my description list.

The first dbref should be the dbref of QueueIt. In A Bug's Muck you can try #764 for QueueIt, though that might change or go away. The second dbref is that of the event handler. In A Bug's Muck, you can try #970, though again I can't guarantee it will remain available. The number in between, 3, is the delay in seconds before the event handler runs. If you want a variable delay, try something like this: {muf:#764,{dice:10} #970}. That will start the handler 1-10 seconds later. It's a good idea to keep your delay brief, because a player may pass through the room quickly.

To use the Room Event Handler, you need to set up a property list either on the room where you called the QueueIt program, or somewhere up the environment tree, like the room's parent environment room. There is one mandatory property, a property list called _events#, and an optional property, _event_chance which should contain a value from 1 to 100, representing the percent chance that an event will occur upon looking at the room. If _event_chance is not present, the handler will assume a default chance of 20%. Here's a typical setup:
This setup gives a 15% chance that when looking at the room, one of the three messages will be generated.

You can also perform some name substitutions with the event handler. The following substitutions are allowed:
So you could set an event like this:
In my opinion, the key to effective use of this sort of thing is to keep the chance of an event small, keep the event appropriate to the location, and keep events passive with respect to players (don't create power-posing events). In any case, have fun!