SciffyMUD

Programming SciffyMUD: In-Game Actions

This document attempts to explain just what is involved in making functions work, from an administrator perspective, in the MUD.

I apologize if this is a little daunting, but I really can't afford the development time, or the required space, to put in another full command parser for this. However, I have tried to keep this as simple as I can in terms of actually using it. You may want to mess around with these on a copy of the MUD which isn't online, at least until you get the hang of it - but it isn't as bad as it looks. Really!

Actions are used for just about everything which happens automatically, especially things which are done as part of quests, which administrators need to set up and change while the MUD is running. Thus, in order to administer the game (i.e. set up a quest), you need to be at least vaguely conversant in how actions work.

In the MUD Language (which I call MUDL, pronounced "muddle"), an Action is a basic, low-level command in a format which can be easily understood by the MUD. By combining actions in a logical order, you can build up a type of action called a function, which does something of logical importance.


All actions simply consist of a string of characters, with no punctuation or spaces between them. If you want to test an action, you can use the action <action-string> administrator command.

Firstly, you need to know that the entire game is just a collection of data (information), which gets changed around as people do things. When someone moves from one room to another, it is just a case of changing the room index associated with that character.

Everything you can do in the MUD comes down to changing one or more pieces of information (each known as a datum).

Firstly, we will describe the various data in the game. These can come in several forms:

  • Strings - a number of letters, punctuation, colours, and so on, used to make up a piece of text. For example, a players' name.
  • Numbers - an integer number, which can be positive or negative. For example, a player's age.
  • Booleans - a flag; this can be "true" or "false". For example, if the player is an administrator or not.

You can use any data type as if it were any other type. (For instance, if you took a number variable, and interpret it as a boolean, the boolean would contain either "true" if it was non-zero, or "false" if it is zero): "true" or "false" in lowercase
TABLE OF CONVERSIONS

from a string ...

from an integer number ...

from a boolean ...

... to a string

(same value) the decimal form of the number

... to an integer number

0, or a decimal number at the very start of the string(same value)1 if true, 0 if false

... to a boolean

True if the first four letters are "true", ignoring case and whitespacetrue if not 0, false if 0(same value)

However, you have to select an appropriate operation if you want to change the value of a datum. So, you can set the name of something to a boolean (you'll get something called "true" or "false"), but you can't then use boolean-toggle that name, because it's a string.

The basic problem now is, how do we get the game to actually do something?

Well, sure, we can run around as administrators, tweaking the Matrix every time that someone does anything, each one of us taking an eight-hour shift every day - but it's nice to be able to do things automatically. That's why we're using a computer in the first place.

So, there is a particular kind of command, called an Action, which consists of a simple string. In order to pass this easily around, through all of the mud's confusing punctuation/whitespace/anything-useful insensitive things - this format consists only of letters and numbers.

A complete command is worked out by appending (or "concatenating") shorter segments of commands, which are separated by the letter 'Z'. I would recommend always writing Z in uppercase, for clarity, and everything else in lowercase.

Firstly, we need to say which datum that we want to manipulate:

  • str - for a string
  • num - for a number
  • boo - for a boolean
  • fun - for a function

In the case of functions, we need to say the function name:

  • Character functions:
    • chrZrerollall - make all characters in the MUD have their statistics re-rolled. (This is intended to correct bugs relating to initial stats getting corrupted)
    • chrZ<Index>ZhitZchrZ<Index> - first character (A) hits the second character (B). B is informed of this, but A isn't. If B dies, then A still gets the XP
    • chrZ<Index>Zlogout - logs out the player of the character
    • chrZ<Index>ZabodeZ<number> - upgrades (or downgrades) character's abode to level number; does not deduct any moneies. (Not yet implemented)
    • chrZ<Index>ZbuyabodeZ<number> - upgrades (or downgrades) character's abode to level number; appropriate monies are deducted. A message is output instead if monies are not available.. (Not yet implemented)
    • chrZ<Index>ZmessageZ<string> - sends the given message to the character via. the great SciffyMud postal system. (Not yet implemented).
  • Room functions: (NYI)
    • romZ<Index>Zdelete - deletes the given room
    • romZcreate - creates a new, unattatched room
  • Object functions: (NYI)
    • objZ<Index>Zdelete - deletes the object
    • objZcreateZobtZ<Index> - creates an object of given type
  • Object-type functions: (NYI)
    • obtZ<Index>Zdelete - deletes the object-type
    • obtZcreate - creates a new object-type (identical to dust)
  • Timer functions:
    • timZkillall - deletes all timers
    • timZ<Index>Z* - not yet implemented, as the indexes of timers are continuously changing.
    • Global functions:
      • gloZcommandZ<String> - runs the command, by causing VIB to type it in. Note that the command can take no "Z"s.

    For everything which isn't a function, we then need to declare which datum we're trying to edit. Currently, the <Index> must be specified as a number.

    • Character data:
      • chrZ<Index>Znam - name (String)
      • chrZ<Index>Zdec - description (String)
      • chrZ<Index>Zage - age when character created (Number)
      • chrZ<Index>Zali - alignment (Number)
      • chrZ<Index>Zjob - character class (Number)
      • chrZ<Index>Zdna - species (Number)
      • chrZ<Index>Zskl - current skill (Number)
      • chrZ<Index>Zstm - current stamina (Number)
      • chrZ<Index>Zluk - current luck (Number)
      • chrZ<Index>Zisk - initial/maximum skill (Number)
      • chrZ<Index>Zist - initial/maximum stamina (Number)
      • chrZ<Index>Zilu - initial/maximum luck (Number)
      • chrZ<Index>Zlvl - experience level (Number)
      • chrZ<Index>Zxp - experience "banked" so far (Number)
      • chrZ<Index>Zxpt - experience gained today and not banked (Number)
      • chrZ<Index>Zrom - current room (Number)
      • chrZ<Index>Zstt - statue text (String)
      • chrZ<Index>Zabo - abode-level; setting this will create and destroy housing for the character as required, as well as teleporting the character to their new home/park-bench (Number)
      • chrZ<Index>ZinvZ<index>Z - object in inventory (follow with object parameter) - NOT YET IMPLEMENTED
    • Room data:
      • romZ<Index>Znam - room name (String)
      • romZ<Index>Zdcs - short description (String)
      • romZ<Index>Zdec - full description (String)
      • romZ<Index>Zsto - storage state; i.e. can you steal statues here (bool)
      • romZ<Index>Zabo - index of character who abodes here, -1 for not-an-abode (Number)
      • romZ<Index>Zlvl - level of room (Number)
      • romZ<Index>ZoutZ<directional-index> index of room in given direction - NOT YET IMPLEMENTED
      • romZ<Index>ZobjZ<index>Z object in room (follow with object parameter) - NOT YET IMPLEMENTED
    • Object data:
      • objZ<Index>Znam - name (blank means use type name) (String)
      • objZ<Index>Zmod - modifier (Number)
      • objZ<Index>Zqty - quantity, meaningless for non-multiple object-types (Number)
      • objZ<Index>ZtypZ - type of object (follow with object-type parameter) - NOT YET IMPLEMENTED
    • Object-Type data:
      • obtZ<Index>Znam - name (String)
      • obtZ<Index>Zdcs - short description (String)
      • obtZ<Index>Zdcl - full description (String)
      • obtZ<Index>Zxpv - experience value (Number)
      • obtZ<Index>Zwgt - weight (Number)
      • obtZ<Index>Zwer - wearable (Bool)
      • obtZ<Index>Zget - getable (Bool)
      • obtZ<Index>Zuse - useable (Bool)
      • obtZ<Index>Zvis - visible (Bool)
      • obtZ<Index>Zwep - weapon (Bool)
      • obtZ<Index>Zedg - edged-weapon (Bool)
      • obtZ<Index>Zarm - armor (Bool)
      • obtZ<Index>Zval - Base Value of object in a shop (Number)
      • obtZ<Index>Zmul - Multiple, i.e. can we carry several of this (Bool)
    • Global data:

    Following this, the particular operation you want should be given:

    • Strings
      • truncate - remove all of the text from the string.
      • append(String) - add another string to the end of this one
      • prepend(String) - add another string to the start of this one
      • replace(String) - give this one the value of another String
    • Numbers
      • Setto(number) - set the number to the value of another number
      • Add(number) - increment the number by the value of another number
      • Invert() - keep the size of the number the same, but make it positive if it was previously negative, or negative if it was previously positive
      • Positive(number) - make the number positive
      • Negative(number) - make the number negative
    • Booleans
      • Toggle - if the value was true, it becomes false, and vice. versa. (like turning a light on and off by toggling the switch).
      • Settrue - make the boolean become true.
      • Setfalse - make the boolean become false.
      • Set(Boolean) - set to the value of another boolean

    For those parameters which take another value, you must specify the particular value:

    • valueZ<value> - the typed-in-value (note that string values used in this way cannot contain the letter Z)
    • from - To refer to another datum, you should repeat the above sequence, from chr/rom/obj/obt/glo to the datum name
    Please do not use from yet; not yet implemented.
  • Some Example Actions

    • strZchrZ2ZsttZsetZvalueZdrone - Set Character #2's logout-text to "drone" (instead of being "statue").
    • numZobjZ12ZmodZaddZvalueZ2 - add +2 to the modifier of object #12
    • booZobtZ15ZvisZsetfalse - make all objects of type #15 invisible
    • numZromZ6ZlvlZaddZfromZobtZ5Zwer - increase the level of room #6 by one, if object #5 is wearable.

    Re-read this page until you understand that last one :-) (hint: obtZ5Zwer is a boolean, so it has numerical value of 1 if true, and 0 if false)


    Back to Magic

    Back to Creation

    Back to index

    Zarlock the Superfluous to Requirements
    Last modified: Sun Apr 29 21:25:36 BST 2001