« Tightening the screws | Main | Creating a simple mprog »

mprogs

July 20, 2005

An introduction to *progs: The basics

Credits: This guide is based on the Time of Darkness *prog guilde, written by Oaklore with a great deal of collaboration from Coyote. Robbie Roberts, Aaron Buhr, are the original creators of Mobprogram code, modified for ToD by Coyote and myself. All errors in this document are entirely mine. Please let me know of them so they may be corrected. This document will be revised on an ongoing basis, and any feedback or further questions are most welcomed.



2006-01-30: It seems most people are getting here from google searches. Welcome aboard. These pages refer to a prog system that is not-quite stock Rot, however should be broadly applicable. If you find errors, omissions, have a question or find it useful, please leave a comment.

Mob programs are one of the more complicated parts of on line creation. They needn't be, and this guide will be a walkthrough of some of the basics, with examples building on each other to eventually create some complex programs.

*Progs are used to control the action of a mob, object or even a room. All progs, no matter what they are attached to, use the same code and function in the same way, with some small exceptions, which will be noted where applicable. A program written for a mob will work equally well on a room, and vice versa.

Anatomy of a prog

Progs are written in a mix of english and gibberish (more on that later), though they do have a simple structure, which consists of three types of things:

  • Player commands - These are things like say, get, wear, drop. In the code, you write them as you would use them yourself. These are also restricted by level, so if the mob is level 15, don't expect it to have immortal commands.
  • Mob commands - These are additional commands that are specific to mob progs, to allow programs to do things impossible with player commands. In the prog, these are always prefixed with "mob ", even if it's a program intended for a room or object.
  • Control statements - IF/ELSE/ENDIF These control the flow of the program, based on the conditions you specify.
  • Of course, to get to writing them, it helps to know a few commands that will help you view, create, edit and otherwise display the progs.

    Mud Commands

    These commands are not part of OLC, but are very useful to

    mpstat/opstat/rpstat <name/vnum for rooms> - This command lists the vnum, name and target of the subject and any *progs attached.

    mpdump/opdump/rpdump <prog vnum> - The will display the program code, an easy way to look inside a current program without editing it. As rprogs/oprogs/mprogs are identical, any of these commands will dump any mprog, regardless of whether it's intended (or attached to) a room, mob or object.

    proglist <area> - This will list the vnums of progs in either the current area or the area specified.

    OLC Commands

    These commands are much like other OLC building commands, so should be straight forward:

    mpedit create <vnum> or mpedit <vnum> - This will create a blank mprog or edit an existing mprog.

    Once you have created (or entered editing mode), the following commands are used:

    code - This employs the OLC description editor (as used to describe rooms) to edit and manipulate code.

    When the prog is complete, you will want to attach it to the room/item/object. This is done by entering the appropriate editor (oedit, redit, medit).

    add(m/o/r)prog <prog vnum> <trigger> <phrase/percentage/direction>
    del(m/o/r)prog <prog sequence number>

    Attaching and removing progs and triggers will be covered in greater depth after we have created some progs to attach, it is listed so there will be a ready reference page later with all the commands you may wish to use.

    Scrawled illegibly by Meathe at July 20, 2005 11:01 AM

    Comments