Home » Immortals »

Contexts

A context is an internal data structure that is used to describe a situation that has occured within the mud. Contexts are mainly used in events, but they also turn up in a few other situations where conditions must be evaluated.

Note that contexts do not tell you what has happened, they simply contain details about the mobs, objects, and other details that are involved.


Information Contained in a Context

Each context can contain the following:

observer (mob)

This is the mob who is observing the situation. The mob who is watching. It is different for each observer.

actor (mob)

This is the mob that is the active party in the situation. The mob that is doing.

victim (mob)

This is the mob that is the target of the actors action. The mob that is being done to.

primary object (object)

This is the main object that the actor is manuiplating. The object that is being done with.

secondary object (object)

This is the ancilliary object that the actor is involving. The object that is being done to.

location (room)

This is the room where the action is happening. If the observer, actor and victim are in the same room, then it is that room. If they are in different rooms, then which room it is depends upon the situation.

number (int)

This is a number associated with the situation. It is used in several different ways, depending upon the situation.

text (string)

This is a test string associated with the situation. Again, there are several different ways it is used, depending upon the situation.

wev (event)

If the context is generated as a part of an event, then this will be a pointer to that event. The event also has a pointer to the context. This allows conditions which are evaluated against the context to reference data from the event.


Sample Contexts

Situation - Leaving a Room

When a character walks out of a room, the following information is put into the context:

Situation - Hitting Someone

When one mob hits another mob, the following information is put into the context:

Situation - Putting a Sword into a Chest

When one mob puts an object inside another one, the following information is put into the context:

For details about the contexts provided for events that occur within the mud, see the events command which is available within OLC.