Note: This article is about a game aspect that it only accessible to the immortal designers, and is of no use to mortal players.

A Mudprog, sometimes called mprog, mobprog, or just prog, is a program that a builder or immortal writes to create a game-world that is deep, interesting, and interactive. This allows builders to do more than simply create maps and dump soulless characters and mundane objects in to them. Any room, mobile, object, or kflag can have a mobprog on it. Sharmair has designed a fantastic and extremely deep mudprogging system, which allows for an extremely in-depth interactive world.

Mudprog Creation Summary Edit

Several elements come in to play when dealing with mudprogs. A mudprog may interact with any number of objects, characters, rooms, and kflags. There are a number of commands to edit each type of mprog. Each mobprog is activated with a trigger. Once the trigger is triggered, the mudprog's code is executed. The code usually including ifchecks, mpcommands, regular commands, replacement tokens, and other keywords.

Mudprog Editing Commands Edit

mpstat <target>
opstat <target>
kpstat <vnum>

mpedit <target> <command> [number] <trigger> <value> 

opedit <target> <command> [number] <trigger> <value>
rpedit <command> [number] <trigger> <value>
kpedit <vnum> <command> [number] <trigger> <value>

mpstat, opstat, rpstat, and kpstat will display the mprogs that are already on the target mobile, object, room, or kflag (respectively). mpedit, opedit, rpedit, and kpedit will work on mprogs on the target mobile, object, room, or kflag (respectively). You must be in the room which you are working on. The mobile you are working on should be in the room with you. Any object you are working on should be in your inventory.

Definitions: Edit

target: either the vnum or name of target. Targets called by name should be with you.

Command Effect
add creates a new mprog
delete deletes mprog number


creates a new mprog at number
edit edit mprog number
list lists the current mprogs on target by number
number: the number of the mprog you wish you wish to work on

trigger: the type trigger or program you wish to edit or create. For a full list of triggers, see mptriggers.

The Editing BufferEdit

When you edit or add an mprog, you are put in to the editing buffer. While it is possible to write your mprogs on-the-go in the buffer, it is much easier to write your program in notepad or any other text editor and then paste it in to the buffer. That way, you only need to remember two buffer commands, but you can edit your programs in your own time, and in a familiar, natural way. Nevertheless, here are the buffer commands:

Editing Commands
/l list buffer contents
/c clears the entire buffer
/d line deletes a line
/g line goes to a line
/i line inserts a new line before line number
/r old new global replace
/a exit the buffer without saving
/! command executes command outside the buffer
/s saves and exits the buffer

&nbsp The editing buffer in PLANES supports pasting of many lines of text at once, and the maximum program length is extremely long. PLANES also supports long lines, whereas SMAUG and other codebases only allow up to 80 characters in length. This makes it much easier to simply edit your program in an outside text editor and paste it in to the game. To do so, simply enter the buffer,

Begin entering your text now (/? = help /s = save /c = clear /l = list    

  1. /c to clear whatever is already in there if you are editing or updating a prog.
  2. (paste your program)
  3. /s to save and exit the buffer.

Writing ProgramsEdit


Mprogs can use any regular mortal command to interact with characters, objects, rooms, and anything else. They can also use special //mpcommands// which are simply immortal commands which can only be used in mprogs. For a full list, see mpcommands.

Program FlowEdit

It is perfectly acceptable to have a program that simply acts on a trigger. For example, if I want to have a mobile say "Hello!" every time someone enters the room, I would have a program that is just:

say Hello!


However, if I wanted to only say hello to people who are level 1, I would enter:

if %actor.level% == 1
   say Hello!

This checks the actor's level, and checks if it is equal to 1. If so, the programs says Hello! If not, it does nothing. In this case, %actor.level% is a replacement token. There are many other replacement tokens. For a full list, see replacement tokens. There are other instances where you you an ifcheck. Also, == is an operator. There are other types of operators as well; for a full list, see operators. Every if must also have an endif, so don't forget to endif at the end of your if.


Suppose you want to have something to happen if the character isn't level one?  

if %actor.level% == 1 
   say Hello!
   say Hi!

Here, else tells the program what to do if the if's conditions aren't met. Remember to always close with endif.


For more choices, you can use elseif.

if %actor.level% == 1 
   say Hello!
elseif %actor.level% == 2
   say Hey!
   say Hi!

If the character is level 1, the programs says "Hello!" If they are level 2, the programs will say "Hey!" If they are any other level, the programs says "Hi!"

switch, case, break, doneEdit

You may have a situation where there are a great many possibilities for a particular replacement token or ifcheck. It may be simpler to just use a switch, like so:

switch %actor.level% 
case 1
   say Hello!
case 2
   say Hey!
case 3 
   say Hi!
case 4 
   say Huh?
   greet %actor%

Use switch <condition> to set a condition. In this case, the condition is the character's level, %actor.level% Then use case <condition> to compare against the original condition. Use break to exit the switch. If you do not use break, the switch will continue to go through all the conditions, even if they are false! At the end, instead of a case, there is default, which means anything else.

Always close the switch with done!


The halt keyword immediately ends the flow of the current program. If you are in a subprogram, it will return flow to the program where the call came from.

Subprogs and callEdit

Often, you will have a program that you will want to execute the same code in many cases. A great way to avoid re-writing the same code over and over (and fix it over and over if you want to change it) is to call a subprogram. For instance, if I wanted my NPC, named barmaid, to say "hello" every time someone over level 10 waved, greeted it, smiled at it, or said hi or hello, I would:

mpedit barmaid add sub hello10  

if %actor.level% > 10 
   say Hello!

Then I would create act and speech triggers for greeting, waving, smiling, and saying hi and hello, and simply have each trigger consist of:

call hello10

Now, if I want to change her to greet the person by name, saying "Hello,!" I only have to change one program instead of five.

Subprogs can also be called (and take a return value) as a replacement token: %call.subname% . . . more on that later. Subprogs are also very handy for organizing how you think about your progs. Use subprogs as much as you possibly can!

return and setreturnEdit

The return keyword is used in mprogs to return a value and end the program.

*same as halt 

 return 0  
*when used in COMMAND or LEAVE progs, cancels input 

 return whatever  
*useful for subprogs

return with no argument is just the same as halt, simply ending the program. In command and leave mprogs, return 0 will override the player's input, so their command or movement will not go through. The third example could be the return value of a subprog, called using %call.subprogname%. In this example, %call.subprogname% is a replacement token for whatever. Whatever can be anything, even another replacement token. In this way, subprogs can be used like functions in traditional programming languages.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.