Home » Immortals »

MobProg Overview

About MobProgs


A Mob Prog is a 'program' for a mobile. They enables mobiles to be programmed so that they do more interesting things than simply stand there waiting for someone to kill them.

MobProgs are about enabling mobiles to react to the world around them. When a player walks into a room with a mobile, the mob is able, through a mob prog, to greet them, attack them, give them something, transport them smewhere, or anything else you can persuade the code to do. Mobs also have access to the muds internal timing loops, clock and calandar. By having the mobs react to these, the mob can be made to appear to behave in a non-reactive fashion. This is just an illusion though - the mob is racting, but it is to an event that the player is not aware of.


There are two distinct parts to a mob prog. The first is the trigger, which decides when to initate a particular series of actions. The second is the script, which is a simple list of commands that the mob will obey. The commands can be either normal mud commands (pretty much anything the players can do and the mob has the skills for) or special Mob Commands which allow the mob to do a few things that only immortals can do. The special abilities of the mob commands include actions such as loading objects, transporting players, changing player stats and generating 'sourceless' messages.



Whenever anything happens, that is an event. A player entering a room is an event. A player picking up a chalice is an event. A player attacking a monster is an event. A monster being killed by a player is an event.

All events within CthulhuMud are described with a few simple terms:

Type and Subtype

These identify the general nature of the event (ie put or get) and the more specific nature (get object or get object from container).

Observer, Actor and Victim

The actor is the player or mob causing the event (ie the player). The victim is the player or mob being affected by the action (ie the monster). The observer is the player or mobile who is currently examaning the event.

Primary and secondary objects

These are the objects involved in the event. The primary object is the main one (ie the chalice) while the secondary object plays a less important role (ie the chest).

Number and Text

Some events additionally have a number (ie number of gold coins or direction) and/or some text (ie words spoken) associated with them.


All events have to happen somewhere. This is the room that the actor is in. It is quite common for the observer and the victim to be in the same room.

The parts of an event are actually split into a context and an event which contains it.


When a mob or a player receives an event it will examine it. For players this means presenting it to the human player via their telnet session. For mobs, it means running it past a set of triggers, to see if the mob wants to react to the event. Whenever anything occurs in the presence of a mob, including things that the mob does, the corresponding event gets sent through the mobs triggers.

Each trigger consists of an event type specification (ie get, put, arrive, depart, die) and an optional subtype definition (a subtype of none will match all subtypes). Once a trigger has matched on type and subtype, the conditions associated with the trigger are checked. If all of the conditions match, then the trigger is deemed to have matched the event and the script associated with that trigger is schedulded for execution. Processig of the event stops (ie it will only ever trigger one script).

Challange Triggers

Challange triggers are a special type of trigger that allow a mob to do something that players cannot. A number of commands will build their event and issue it as a challange before they perform the action associated with the command. For instance, the command 'get challace from altar' will generate a challange event (actor=player, pri_obj=challace, sec_obj=altar, type=get subtype=object_from_container). Mobs in the room are able to react to this challange event (ie they are able to react to the players intention, not to their action).

If a mob in the room does react to the challange event, the action does not proceed, and it is up to the script the mob runs to explain to the player why the action did not succeeed. Consider:

  : get challace altar
  Big Ogre stops you from getting the challace
  Big Ogre says 'Leave that alone!'