Programs

By

Tank the Life Bringer at Dawn of Demise

(tdod.org 4000)

 

This is by no means the LAST word on how to make programs for SMAUG-type MUDs, this is merely intended as a "place to start". There are many people who have MUCH more experience when it comes to making programs, and this file is my crude attempt at helping those who are just starting out. The main thing is, this file will provide all the required HELP files in one place for the new programmer.

Programs are the tools that provide "life" to an area, from something as simple as providing "atmosphere" to something as complicated as a fight program. Programs bring the MUD alive.

**NOTE**

Before doing anything in OLC with programs make sure that

  1. The area the program is in has been AASSIGNED to you.

    (this is done if you are building a new area)

  2. The Object or Mob getting the program has been set to prototype.

Making Programs

Programs can be linked to rooms, mobs, or objects. All programs require a trigger to set them in motion. A trigger is an action, phrase, or game event that causes a program held within a room, mob or object, to begin playing out its commands. Triggers can be anything from a player or mob entering a room, to a player stating a particular phrase within a room, or to a mob or an object. Depending on whether a trigger is linked to a room, mob or object, the syntax for each program can be slightly different.

 

*PEDIT

To add, insert, edit, delete, or list a program(s), use the *pedit command.

[The * referring to m for mob, o for object, or r for room. MPEDIT/OPEDIT/RPEDIT]

General Syntax: *pedit <vnum or name> <command> [number] [program] [arguments]

<>= field required []= field optional

 

Commands:

Add: *pedit <vnum or name> Add <trigger> <triggering variable>

Insert: *pedit <vnum or name> Insert <number> <trigger> <triggering variable>

<Number> = if more than one program.

Edit: *pedit <vnum or name> Edit <number> [trigger] [triggering variable]

Delete: *pedit <vnum or name> Delete <number>

List: *pedit <vnum or name> List

Add, Insert and Edit will put you into the line editor to edit your

Program.

**NOTE**

To use opedit, you must have the item in your inventory.

To use rpedit, you must be in the room and vnum is not neccessary.

Syntax: rpedit <command> [number] [program] [arguments]

 

 

*PSTAT

[The * referring to m for mob, o for object, or r for room.]

Mpstat/Opstat

Syntax: *pstat <vnum or name>

Mpstat and Opstat will display all programs for the vnnum specified. If it exists in the game you can perform this function.

Example:

Mpstat 21037

Name: guard man. Vnum: 21037. |

Short description: the guard. |

Long description: A guard patrols the streets of the city. |---Basic mob information

Hp: 495/495. Mana: 100/100. Move: 100/100. |

Lv: 16. Class: 3. Align: 1000. AC: -61. Gold: 500. Exp: 0. |

>greet_prog 2 |

say hello $n |--Program number 1

say Everything OK? |

>greet_prog 2 |

smile $n |--Program number 2

emote tips his helm. |

say Good day to you $n. |

>rand_prog 2 |

emote looks at the sky. |--Program number 3

say Looks like we're gonna get some rain soon. |

>rand_prog 2 |--Program number 4

emote Whistles a cheerful little ditty as he walks by on patrol. |

 

Rpstat

Syntax: Rpstat

Displays all of the room programs that have been written for a

room. You must be standing in the room.

Example:

Rpstat

Name: Inside the Western Gate. Vnum: 21088. -------Room Info

>rand_prog 5 |-------Room program number 1

mpecho An eerie howling can be heard in the distance. |

SETTING UP PROGRAMS

 

Program syntax is as follows:

First lets define the notation. Anything contained in <> is required.

Anything in brackets [] is optional. NL means new line.

<trigger> <argument> NL

<program>

 

 

<TRIGGER> is one of the available triggers (program types).

<ARGUMENT> depends upon the trigger (program type).

<PROGRAM> can be any legal mud command, or a control flow command.

TERMS I WILL BE USING

Trigger holder – the room, mob, or object that contains the trigger.

Mpcommand – special mud commands performed only in programs.

Command – Any command that a Player can perform.

TRIGGERS(PROGRAM TYPES)

Triggers and their names, arguments, and basic translation given below.

 

No triggers will be successful if mobile is charmed.

ROOM TRIGGERS:

Trigger Opt Triggering Variable Explanation

------- --- ------------------- -----------

Act [p] <keyword / phrase> emotes, socials, actions, bamfs

Speech [p] <keyword / phrase> says or tells from same room as mob

Rand <percentage> randomly triggered based on %

Fight <percentage> random, within a fight, based on %

Hitprcnt <percentage> percent is % of mob's max H.P.

Greet <percentage> entry that mob can see, by mob/player

Allgreet <percentage> entry by mob/player, regardless if seen

Entry <percentage> when the mob itself enters a room

Bribe <amount of gold> when a player gives the mob money

Give <item> when an item is given to mob/player

Death <percentage> when the mob dies

Script <hour> [Runs script. Hour triggers start]

Time <hour> [script, runs once on hour specified]

Hour <hour> [loops as Script for hr from start hr]

*NOTE* <hour> is in military time. (15 hours is 3pm mud time.)

*NOTE* The mpcommand MPDONOTHING currently only works in Script progs,

NOT in Time or Hour progs.

OBJECT TRIGGERS:

Trigger Opt Triggering Variable Explanation

------- --- ------------------- -----------

Wear <percentage> when a player wears the object

Remove <percentage> when a player removes the object

Speech {p} <keyword/phrase> says or tells from same room as mob

Rand <percentage> randomly triggered based on %

Sac <percentage> when a player sacrifices the object

Zap <percentage> when the player is zapped due to align

Get <percentage> when a player gets the object

Drop <percentage> when a player drops the object

Damage <percentage> when the object is damaged

Repair <percentage> when the object is repaired

Exa <percentage> when the obj is Examined or Looked upon

Look ** THIS TRIGGER IS NOT CURRENTLY IN USE **

Push <percentage> when a player pushes an object

Pull <percentage> when a player pulls an object

Use <percentage> see USEPROG for details

 

 

 

 

 

MOB TRIGGERS:

Trigger Opt Triggering Variable Explanation

------- --- ------------------- -----------

Act {p} <keyword/phrase> emotes, socials, actions, bamfs

Speech {p} <keyword/phrase> says or tells from same room as mob

Rand <percentage> randomly triggered based on percentile

Fight <percentage> random, within a fight, based on %

Hitprcnt <percentage> percent is % of mob's max H.P.

Greet <percentage> entry that mob can see, by mob/player

Allgreet <percentage> entry by a mob/player, regardless if seen

Entry <percentage> when the mob itself enters a room

Bribe <amount of gold> when a player gives the mob money

Give <Item> When an item is given to a mob/player

Death <percentage> when the mob dies

Script {hour} loops 1 line at a time. Hr triggers start

Time <hour> script prog, runs once on hr specified

Hour <hour> loops as Script for 1 hr from start hour

*NOTE* {hour}/<hour> is in military time. ie, 15 hours is 3p.m. Mud time.

*NOTE* The mpcommand MPDONOTHING currently only works in Script progs,

NOT in Time or Hour progs.

ACT: Room/Mob

Syntax: act_prog [p] <ARGUMENT>The <ARGUMENT> is a list of keywords separated by spaces. The trigger is activated whenver a keyword, or the phrase, is contained in the act() message. Neither the phrase nor keywords are case sensitive.

Act_prog pokes you in the rib

Would trigger on each of the words pokes,you,in,the,and rib.

If the first word is the character 'p' by itself, then the rest of the word list isconsidered to be a phrase.

Act_prog p pokes you in the rib

Would trigger on the phrase "pokes you in the rib"

If the phrase ends in a '.', the words must be found on their own.

Act_prog p pokes you in the rib.

This is the most general trigger. It applies to almost every event, which happens in the mud. Anytime the function act() is called with a message to be delivered TO_CHAR, TO_VICT, TO_ROOM, etc. the act can be triggered. Basically this will trigger on almost everything

you'll ever want (and some things you wont as well).

SPEECH: Room/Mob/Object

Syntax: speech_prog [p] <ARGUMENT>

The <ARGUMENT> is the same as for an act_prog except this is only triggered when the keyword or phrase is contained in a message, which has been said by a PC or NPC. Be careful not to get two or more mobs caught in an endless speech_program loop, where one mob’s speech triggers a second mob’s speech which in return triggers the first mob etc.

 

 

 

RAND: Room/Mob/Object

Syntax: rand_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked at each PULSE_MOBILE with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated. This will happen even if there is no PC present although there must be players in the same area.

This trigger is useful to give some mood to a room or a bit of personality to mobs and objects.

A room can have noises like creaking floorboards.

An object can force a PC to say different things.

A janitor can stop to spit tobacco, complain about the hours,

or wonder why there are no women janitors on muds.

 

 

 

 

 

FIGHT: Room/Mob

Syntax: fight_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked at each PULSE_VIOLENCE with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

Only the first successful fight_prog will be processed. Ensure that multiple fight_prog on the same mob have different <NUMBER>.

This trigger is useful for giving things combat attitude. It can be used to cast spells, emote, yell, etc. Also, this means that the mobile wont get lucky and, for example, curse, cast a fireball, spit on the player, and cast another fireball in the same pulse.

 

 

HITPRCNT: Room/Mob

Syntax: hitprcnt_prog <NUMBER>

The <NUMBER> is the percentage of a Mob’s HP and must be between 1 and 100 inclusive.

The trigger is checked at each PULSE_VIOLENCE with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated. It checks to see if the HP of the mobile is below the given percentage.

Only the first successful hitprcnt_prog trigger is performed.

Multiple hitprcnt_progs should be listed in increasing order of percent since a 40% will always be activated before a 20%.

 

GREET: Room/Mob

Syntax: greet_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked whenever a PC or NPC enters the room, if the room has the trigger, or enters a room that has a mob with the trigger. The PC or NPC must be visible to the trigger holder. The mud generates a percentage roll. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

This trigger can be used for shopkeepers you want to welcome customers, or for making pseudo-aggressive mobiles.

**Note** The trigger will not activate if the holder is fighting.

 

ALLGREET: Room/Mob

Syntax: all_greet_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

This trigger is the same as the greet_prog with the exception of, PC or NPC does not have to be visible.

This trigger can be used, for example, to make a teleport room or an impassable

guardian.

**Note** The trigger will not activate if the holder is fighting.

 

 

 

 

ENTRY: Room/Mob (not to sure about room)

Syntax: entry_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

This trigger is the opposite of the greet_prog. Whenever a mobile, holding the trigger itself enters a new room, the mud generates a percentage roll. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

(I am not sure how this would be attached to a room)

This trigger can be used to make mobs look around, wave, or any other things that real PCs do when they arrive in a crowded room.

Only the first successful trigger is activated. That way the mobile does not look stupid by repeating commands resulting from multiple triggers being activated.

 

 

GIVE: Room/Mob

Syntax: give_prog <ARGUMENT>

The <ARGUMENT> is the complete name of an object.

A complete name is whatever is on the line of the object section following the "Name:" field of an ostat of the object.

Name: Sword Democracy }---------------------------------complete name is "Sword Democracy"

Vnum: 10210. Type: weapon. Count: 2 Gcount: 1

Serial#: 8837 TopIdxSerial#: 8837 TopSerial#: 8877

Short description: The Sword of Democracy.

Long description: A bright golden sword lies here.

Wear flags : take wield

This is triggered whenever something is given to a mobile.

This trigger is good for quests.

 

BRIBE: Room/Mob

Syntax: bribe_prog <NUMBER>

The <NUMBER> is an amount of gold and can be any positive integer number.

This trigger is activated whenever <NUMBER> gold is given to a mobile holding the trigger and the amount given is greater than or equal to the <NUMBER>.

Only the first successful bribe_prog trigger is performed.

Multiple bribe_progs should be listed in increasing order of percent since a "1000 coins" will always be activated before a "100 coins".

Instead of the coins being added to mob’s gold, the mob is given an object, "pile of coins" in the proper amount that the mob holds in inventory. In this way, the mobile can drop the coins or refer to the object by "amount" (short description:"%d gold coins").

This surely has some drawbacks, but it lets the mobile do something with the bribe.

DEATH: Room/Mob

Syntax: death_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

When a mob dies, the mud generates a percentage roll. If the random percentage is less than or equal to the <NUMBER> the mobile performs its program commands rather than the usual death_cry sequence. This is done before the corpse is made, so the commands can be considered the mobiles last gasp.

The position of the mobile is set to dead, and so it can do all the pcommands. However, even if the mobile restores itself to full hp, it will still die. This is not a way to make a mob immortal.

Since the mob’s position is set to ‘dead’ a mob cannot perform command functions such as ‘say’, ‘tell’, ‘remove’, ‘drop’, ‘emote’, etc.

Only the first successful death_prog trigger is performed.

Multiple death_progs should be listed in increasing order of percent since a 20 will always be activated before a 50.

 

 

WEAR: Object

Syntax: Wear_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

When a PC or NPC decides to ‘wear’ an object that has this trigger, the mud generates a percentage roll. If the random percentage is less than or equal to the <NUMBER> the object performs its program commands.

 

 

REMOVE: Object

Syntax: Remove_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

When a PC or NPC decides to ‘remove’ an object that has this trigger, the mud generates a percentage roll. If the random percentage is less than or equal to the <NUMBER> the object performs its program commands.

 

 

SAC: Object

Syntax: Sac_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

When a PC or NPC decides to ‘sac’ (sacrifice) an object that has this trigger, a percentage roll is generated by the mud. If the random percentage is less than or equal to the <NUMBER> the object performs its program commands.

 

 

ZAP: Object

Syntax: Zap_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

When a PC or NPC gets ‘zapped’ by an object that has this trigger, the mud generates a percentage roll. If the random percentage is less than or equal to the <NUMBER> the object performs its program commands.

GET: Object

Syntax: Get_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

When a PC or NPC decides to ‘get’ an object that has this trigger, the mud generates a percentage roll. If the random percentage is less than or equal to the <NUMBER> the object performs its program commands.

 

 

DROP: Object

Syntax: Get_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

When a PC or NPC decides to ‘drop’ an object that has this trigger, the mud generates a percentage roll. If the random percentage is less than or equal to the <NUMBER> the object performs its program commands.

 

 

DAMAGE: Object

Syntax: Damage_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked, when the object containing the trigger gets damaged, with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

 

 

REPAIR: Object

Syntax: Repair_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked, when the object containing the trigger gets repaired, with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

 

 

EXA: Object

Syntax: Exa_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked, when the object containing the trigger gets ‘look’d at or ‘examine’d by a PC or NPC. The mud then generates a percentage roll. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

 

 

LOOK: Object

** NOT CURRENTLY USED**

 

 

 

 

 

 

 

PUSH: Object

Syntax: Push_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked, when the object containing the trigger gets ‘push’ed, with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

 

 

PULL: Object

Syntax: Pull_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked, when the object containing the trigger gets ‘pull’ed, with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

 

 

USE: Object

Syntax: Use_prog <NUMBER>

The <NUMBER> is a percentage and must be between 1 and 100 inclusive.

The trigger is checked, when the object containing the trigger gets USED with a percentage roll generated by the mud. If the percentage roll is less than or equal to the <NUMBER> the trigger is activated.

To define what will trigger the use_prog, here is a list:

* Wands - when you zap

* Staves - when you brandish

* Food/pills - when you eat

* Blood/fountains/drink containers - when you drink

* Lights/armor/weapons - when you wear/wield/hold

* Potions - when you quaff

* Pipes - when you smoke

 

When the use_prog is executed you will not see the standard 'use message'(ie You quaff a violet potion). Instead the objects program commands will be executed.

**NOTE** The use_progs on lights, armor, and weapons are executed BEFORE the player wears/holds/wields any item.

 

 

TIME: Room/Mob

Syntax: Time_prog <HOUR>

This trigger executes its program at <HOUR>.

<HOUR> is in military time 8=8:00am while 20=8:00pm.

The best example of this is the Darkhaven gate guards opening and closing gates at specific times of the day.

 

 

 

 

SCRIPT: Room/Mob

Syntax: Script_prog <HOUR>

This trigger runs script at <HOUR>? I’m not quite sure about this one.

 

 

HOUR: Room/Mob

Syntax: Hour_prog <HOUR>

This trigger executes its program at <HOUR>, in a continuous loop for 1 hour.

<HOUR> is in military time 8=8:00am while 20=8:00pm.

PROGRAM COMMANDS

 

Once you've set the trigger for a program, you enter into a line text editor that you use to write the program itself (See the end of this help for the text editor usage).

A program can perform many tasks such as issuing mpcommands, commands, ifchecks, or merely printing text to the screen.

We are going to break this section in to 4 basic parts, Mpcommands, ifchecks, operators and variables, and last but not least writing a program.

 

MPCOMMANDS

(MPCOMMANDS RPCOMMANDS OPCOMMANDS)

I’ve never personally had to use anything other than mpcommands but have included rpcommands and opcommands (room and object respectively) just in case you run across them in the future.

These are fairly basic things, most of them are wiz commands which have been changed to allow for mobiles to perform the commands. If you have the problem of immortals abusing these powers on your mud either ditch the immortals, or add a check in all of them to only let NPC's with null descriptors do the commands. (However, you lose a little debugging help that way).

 

The following is a chart of commands can be used for Room, Mob and Object programs. The commands listed at the bottom are for mob programs only. Each command also has its own help file. Type HELP <COMMAND>.

MPCOMMAND PARAMETERS

-------------- -------------------

MPASOUND <phrase>

MPECHOAROUND <name/var><phrase>

MPECHOAT <name/var><phrase>

MPECHO <phrase>

MPMLOAD <mob vnum>

MPOLOAD <object vnum>

MPPURGE <object/mobile name>

**MPADVANCE <player name><level>

MPTRANSFER <name/all>

MPFORCE <name/all><actions>

MPSLAY <victim>

MPDREAM <name><phrase>

MPDAMAGE <name><#hps>

MPCLOSEPASSAGE <room><direction>

MPOPENPASSAGE <origin><dest><dir>

MPJUNK <name/var>

MPINVIS <Level>

MPRESTORE <victim> <amount>

**MPPRACTICE <victim> (skill|spell) (max_percent)

**MPPKSET <victim> yes/no

Mobs only:

MPKILL <name>

MPGOTO <vnum>

MPAT <vnum> <command>

 

**These mpcommands really shouldn’t be used

MPDAMAGE

Syntax: mpdamage <victim> <amount>

Example: mpdamage 0.$n 100 (Do 100 hps damage to player $n, $n being a variable listed below)

This command inflicts a specified amount of damage on the victim.

Mpdamage is affected by ‘sanctuary’, but is not affected by ‘protect’, saving throws or resistances.

all’ is not a valid victim.

Example: mpdamage all 100 will not work

A mob should never mpdamage itself, at risk of crashing.

 

 

MPINVIS

Syntax: mpinvis

or

Syntax: mpinvis <level>

This command controls a mob's ability to use a modified form of wizinvis.

Use 'mpinvis' alone to toggle the invisibility at the level of the mob.

Use 'mpinvis <level>' to set the level at which the mob will be invis.

Mortals under the mobinvis level of the mob will be unable to see the mob when it goes mobinvis; they cannot see it with any spell, it will be completely invisible to them.

Be warned, however, that its programs will still function as normal, the mortal will simply see a 'someone' if it performs an action or an echo that they see, just as if a wizinvis immortal performed the action.

Also be warned that at the present time area attacks, such as ‘gas breath’, will hit a mobinvis creature even if it is invisible.

 

 

MPRESTORE

Syntax: mprestore <victim> <amount>

Example: mprestore self 200 (Trigger holder restores self with 200 Hp)

This command restores a specified number of hp to the victim.

 

 

MPSLAY

Syntax: mpslay <victim>

This command orders the trigger holder to slay the victim in cold blood. The victim gets no saving throw.

 

 

MPASOUND

Syntax: MPASOUND <phrase>

Displays the <phrase> to all rooms surrounding the trigger holder as a death cry.

This is really useful as a warning to players for powerful aggressive mobs. It is also and is also nice for wandering minstrels.

 

MPECHO or MPE

Syntax: MPECHO <phrase>

Displays <phrase> to the entire room.

 

 

MPECHOAT or MEA

Syntax: MPECHOAT <name> <phrase>

Displays a phrase to only the victim.

The abbreviation "mea" may be used for mpechoat.

 

 

MPECHOAROUND (MER)

Syntax: MPECHOAROUND <victim> <phrase>

Displays a phrase to all in the room except victim.

The abbreviation "mer" may be used for mpechoaround.

ECHO COLORS

The following 16 colors are supported in the commands echo, recho(room echo),

Code | Color Code | Color

-----+-------------- -----+------------

whi | White (Default Color) yel | Yellow

blu | Blue dbl | Dark Blue

lbl | Light Blue cya | Cyan

gre | Green dgr | Dark Green

cha | Charcoal (Grey) dch | Dark Charcoal (Dark Grey)

pur | Purple (Magenta) red | Red

ora | Orange bro | Brown

pin | Pink bla | Black

A _ precedes the color.

If an asterisk precedes the color indicator, the message will blink.

To save line space, yYou only need to enter as much of the color

indicator as required to uniquely identify it.

Examples:

recho _red This is an example of recho in red.

recho *red This is an example of recho in blinking red.

mpecho _yel This is an example of mpecho in yellow.

mpe _yel This is an example of mpecho in yellow.

mpechoat $n _blu This is an example of mpechoat in blue.

mea $n _blu This is an example of mpechoat in blue.

mpechoaround $n _bro This is an example of mpechoaround in brown.

mer $n _bro This is an example of mpechoaround in brown.

 

 

 

 

 

 

 

 

 

 

 

MPFORCE

Syntax: MPFORCE <victim>

Forces a player/mob to do a command, non-functional on immortals. You can use ‘all’ as <victim> with mpforce.

The victim is not told that they are forced, they just do the command so usually some mpecho message is nice.

You can force players to remove belongings and give them to the trigger holder, etc. The player sees the normal command messages, such as removing the item and giving it away in the above example.

 

 

MPDREAM

Syntax: MPDREAM <victim> <phrase>

Sends a message to a sleeping character.

 

 

MPJUNK

Syntax: MPJUNK <object>

Destroys an object in inventory/being worn - can be used with all.object.

It prints no message to the world. You can do things like ‘junk all.bread’ or ‘junk all’.

This is nice for having janitor mobiles clean out their inventory if they are carrying too much. Give the janitor an ‘act_prog p full inventory’ and a program that would ‘junk all’.

 

 

MPMLOAD MPOLOAD

Syntax: MPMLOAD <vnum> [level]

Example: mpmload 1000 20 (Invoke mob 1000 at level 20)

Syntax: MPOLOAD <vnum> [level] [timer]

Example: mpoload 1000 20 (Invoke object 1000 at level 20)

mpoload 1000 20 30 (Same as above, but with a 30 tick timer)

Loads a mob or object into the inventory or room of the trigger holder.

In the case of mpoload being performed by a room, the level must be set, or the supermob will end up setting the level. Also the program needs to drop <vnum> or it won’t appear in the room.

In the case of mpoload being performed by a mob, the object will be loaded into the mob’s inventory.

The timer is optional, and is the decay timer for object. When the timer reaches 0 then the object is purged.

This lets a mobile distribute a quest item or load a key or something.

 

 

 

 

 

 

 

 

 

 

MPPURGE

Syntax: MPPURGE <object/mobile>

Example: mppurge (Purges entire room)

mppurge key (Purge the first key)

mppurge dog (Purge the mob named "dog")

Purges the room, or a specified object/mobile.

If a mobile performs ‘mppurge $i’ ($i is a variable referencing the mobile), the mobile will purge its self, but it MUST be the last command the mobile tries to do, otherwise the mud cant reference the acting mobile trying to do the commands.

 

 

MPTRANSFER

Syntax: MPTRANSFER <victim> <location>

Example: mptransfer $n 1000 (Transfer victim to room 1000)

mptransfer $n joe (Transfer victim to mob "joe")

mptransfer all 1000 (Transfer all in trigger room to room 1000)

Transfers one or all PC’s or NPC’s in the room to a specified location. If no location is specified the victim(s) are transferred to the trigger holder.

Good for starting quests or things like that. There is no message given to the victim(s)saying transference has occurred, and the victim does not ‘look’ at new location. It is a good idea to add ‘mpforce <victim> look’ in conjunction with this mpcommand.

Immortals cannot be transferred.

 

MPOPENPASSAGE MPCLOSEPASSAGE

Syntax: MPOPENPASSAGE <origin> <destination> <direction>

Example: mpopenpassage 1000 1002 0 (Open a passage north from room 1000 to room 1002)

Opens a passage to a room (does not affect pre-existing doors)

Syntax: MPCLOSEPASSAGE <room> <direction>

Example: mpclosepassage 1000 0 (Close the north passage in room 1000)

Closes a passage to a room (does not affect pre-existing doors that were not created with mpopenpassage)

<direction> must be referred to as a #:

0 North 6 Northeast

1 East 7 Northwest

2 South 8 Southeast

3 West 9 Southwest

4 Up 10 Somewhere

5 Down

 

 

MPKILL Mob only

Syntax: MPKILL <victim>

Lets a mob kill the victim without having to murder and be fifth level. It works on both mobs and players.

 

 

 

 

 

MPAT Mob only

Syntax: MPAT <vnum> <command>

Example: mpat 1000 drop all (Mob drops its inventory at room 1000)

Lets the mobile perform a command at <vnum> of another location.

Very useful for doing magic slight of hand tricks that leave players dumbfounded, such as metamorphosing mobiles, guard summoning, or a corpse vanishing.

 

 

MPGOTO Mob only

Syntax: MPGOTO <vnum>

Moves the mobile to any room or mobile requested, which is not private. It makes no message of its departure or of its entrance, so it is a good idea to include a mpecho to announce its departure or entrance.

 

 

MPADVANCE should not be used

Syntax: mpadvance <name> <level>

Advances the level of a player (not functional in prototype programs)

 

 

MPPKSET should not be used

Syntax: mppkset <victim> yes/no

This command tells the mob to set the victim to either deadly or non-deadly.

Mppkset yes will set the victim to deadly status.

Mppkset no will set the victim to non-deadly status.

 

 

MPPRACTICE

Syntax: mppractice <victim> <skill/spell/language> <amount>

This command will set the victim's percentage of proficiency in the specified skill/spell/language to the specified amount.

It cannot train a character in a skill/spell/language the character does not have as a part of its class and that it does not already have as a result of its level. In other words, it canot train a warrior in fireball, or a level 1 thief in gouge.

 

Variables

Ever wonder why some mobs seem to know your name considering it would be close to impossible to write a program for every aspect of every character in the mud. To make this process easier we use variables to represent different things such as PCs, NPCs, pronouns, etc.

These are represented in the programs by using a dollar sign convention. When the mud command is processed, these variables are expanded into the values shown below. Usually, it is best to use the short descriptions of mobiles and the names of players when speaking them, but if you are performing an action to someone almost always you want the name. The title field for players is an extra that probably won’t often be used.

The variables:$i the first of the names of the mobile itself.$I the short description of the mobile itself.$n the name of whomever caused the trigger to happen.$N the name and title of whomever caused the trigger to happen.

$t the name of a secondary character target (i.e. A smiles at B)

$T the short description, or name and title of target (NPC vs. PC)

$r the name of a random char in the room with the mobile (PC’s Only)

$R the short description, or name and title of the random char (PC’s Only)

$j he, she, it based on sex of $i.

$e he, she, it based on sex of $n.

$E he, she, it based on sex of $t.

$J he, she, it based on sex of $r.

$k him, her, it based on sex of $i.

$m him, her, it based on sex of $n.

$M him, her, it based on sex of $t.

$K him, her, it based on sex of $r.

$l his, hers, its based on sex of $i.

$s his, hers, its based on sex of $n.

$S his, hers, its based on sex of $t.

$L his, hers, its based on sex of $r.

$o the first of the names of the primary object (i.e. A drops B)

$O the short description of the primary object

$p the first of the names of the secondary object (i.e. A puts B in C)

$P the short description of the secondary object

$a a, an based on first character of $o

$A a, an based on first character of $p

VARIABLE MOBILE ACTOR VICTIM RANDOM OBJECT 2ND_OBJECT

--------------- ------ ----- ------ ------ ------ ----------

Name $i $n $t $r $o $p

shrt_desc/title $I $N $T $R $O $P

he/she/it $j $e $E $J -- --

him/her/it $k $m $M $K -- --

his/hers/its $l $s $S $L -- --

a/an -- -- -- -- $a $A

Also, in if_checks, the accepted variables are the basic ones; i, n, t, r, o, p. If a variable is referenced that doesn’t exist, then the value is simply left blank. Example: referring to $o when the trigger is ‘A kisses B’

The only problem with the variables is that the secondary object and the secondary target are passed by act() in the same location. This means that if you reference $t in an ‘A puts B in C’ situation, the result will probably be a happy mud crash or some weird side effect, especially if $t is used in an if_check (i.e. if isnpc($t) in the above situation) The basic fix for this is to change everyone who calls the act() procedure to specify a secondary object and a secondary character.

Operators

Most of the basic numeric operators are legal and perform the same function, as in C. The string operators are a bit more confusing. There are negative versions of some of the operators. These are not strictly needed, since the if/else construct of Control Flow commands can handle either case.

Numeric Operators: ==(equals), >(greater than), <(less than), !(not), != (not equal), >=(greater than or equal), <=(less than or equal), &, |

String Operators: ==, !=, /, !/For strings:

== and != (not equal)check for exact match between the two strings.

Example: Using == on a name implies that you are matching the complete name "cityguard" or "guard" or whatever.

The other two, / and !/, check to see if the second string is contained in the first one.

Example: "if name ($n) / guard" will respond true to "cityguard", "guard", "guardian" etc.

The string operators are case SENSITIVE.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If Checks

The provided list of if_checks and their arguments are below. They should all be fairly obvious in what they do, but some of the more obtuse deserve a slight explanation.

Any '==' operator can be replaced with any of the available ones described above.

The argument ($*) refers to any of the variables which make sense for that if_check

Example: In an if_check which is referencing a person, the only valid variables would be $i, $n, $t or $r)

A value type of string is a sequence of characters and does not need to be included in quotes.

Example name($n)== orc large brown

An argument of x refers to any number

An argument of y refers to any number 1-100 inclusive

If Hitprcnt($*)== y Is the hit/max_hit of $* equal to percentage y

I.E. If hitprcnt($i)==20 are mob’s hit points at 20% of maximum?

If Inroom($*)==x Is $* in room number x, where x equals a vnum.

I.E. If Inroom($n)==1200 Is the character that activated the trigger in room 1200

If Sex($*)==# Is $* sex = to #? Valid # are: 0=Neuter, 1=male, or 2=female

I.E. If Sex($n)==2 Is the character that activated the trigger female?

If Position($n)==# Is $* in position #?

I.E. If Position($n)==4 Is the character that activated the trigger sleeping?

If Level($*)==# Is $* level #?

I.E. If level($n)==25 Is the character that activated the trigger level 25?

If Isnpc($*) Is $* a Non-Player Character?

I.E. Isnpc($n) Is the character that activated the trigger a NPC?

If Ispc($*) Is $* a Player Character?

I.E. Ispc($n) Is the character that activated the trigger a PC?

If Isgood($*) Is $* alignment greater than or equal(>=) to 350?

If Isevil($*) Is $* alignment less than or equal(>=) to -350?

I.E. If Isfight($n) Is the character that activated the trigger fighting?

If Isimmort($*) Is $* an immortal?

I.E. If Isimmort($n) Is the character that activated the trigger an immortal?

If Ischarmed($*) Is $* affected by "charm"

I.E. If Ischarmed($i) Is the mob that caused the trigger charmed?

If Isfollow($*) Is $* following a "master" (charmed mobs only?)

I.E. If Isfollow($i) Is the mob that caused the trigger following its master?

If Isaffected($*)==<affect> Is $* affected by <affect>?

Affects:

BLIND

INVISIBLE

DETECT_EVIL

DETECT_INVIS

DETECT_MAGIC

DETECT_HIDDEN

HOLD(not used)

SANCTUARY

FAERIE_FIRE

INFRARED

CURSE

FLAMING(not used)

POISON

PROTECT

PARALYSIS

SNEAK

HIDE

SLEEP

CHARM

FLYING

PASS_DOOR

FLOATING

TRUESIGHT

DETECTTRAPS

SCRYING

FIRESHIELD

SHOCKSHIELD

HAUS1(not sure about this)

ICESHIELD

POSSESS

BERSERK(not sure about this)

AQUA_BREATH

RECURRINGSPELL(not sure about this)

CONTAGIOUS(not sure about this)

I.E. If Isaffected($n)==hide Is the character that activated the trigger hidden?

If Number($*) ==<#> Is $*’s vnum equal to #? (not sure about this one)

I.E. If Number($i)==2100 Is the mob’s vnum 2100?

If Race($*)==<STRING> Does $*’s race equal <string>?

Valid races:

HUMAN

ELF

DWARF

HALFLING

PIXIE

VAMPIRE

HALF-OGRE

HALF-ORC

HALF-TROLL

HALF-ELF

GITH

DROW

SEA-ELF

LIZARDMAN

If Guild($*)==<STRING> Is $* a member of guild <STRING>

  1. Mage

  2. Cleric

  3. Thief

  4. Warrior

  5. Vampire

  6. Druid

  7. Ranger

  8. Augurer

  9. Paladin

  10. **Nephandi (Assassin)

  11. **Savage (Demon)

  12. **Pirate (Angel)

  13. **pc12

  14. **pc13

  15. **pc14

  16. **pc15

  17. **pc16

  18. **pc17

  19. **pc18

  20. **pc19

  21. baker

  22. butcher

  23. blacksmith

  24. mayor

  25. king

  26. queen

If Ismounted($*) Is $* affected by mounted?

If Ismobinvis($*) Is $* affected by mobinvis?

I.E. If Ismobinvis($i) Is Mob that activated the trigger mobinvis?

 

If Mobinvislevel($*)==# Is $*’s mobinvis level equal to #?

Room vnum will determine Area for economy only

I.E. If economy(21001) > 10000000 Is the areas economy above 10000000?

If Favor($*)==# Is $*’s favor equal to # (# is number -1000 to 1000)

If Isdevoted($*) Is $* Devoted?

I.E. If Isdevoted($n) Is the character that activated the trigger devoted?

 

If Deity($*)==<STRING> Is $* devoted to <string>?

If Mortal($*) Is $* a mortal?

  1. CoE - Council of Elders

  2. TS - The Symposium

  3. NC - Newbie Council

  4. Pro - Primordial Circle

  5. PK - Pkill Conclave

  6. QC - Quest Council

  7. Neo - Neophyte Council

  8. CC - Code Council

  9. AC - Area Council

0 North 6 Northeast

1 East 7 Northwest

2 South 8 Southeast

3 West 9 Southwest

4 Up 10 Somewhere

If Objtype($*)==<#> Is the type of $* equal to <#>

Valid types: **Not currently used

  1. **NONE

  2. LIGHT

  3. SCROLL

  4. WAND

  5. STAFF

  6. WEAPON

  7. **FIREWEAPON

  8. MISSILE

  9. TREASURE

  10. ARMOR

  11. POTION

  12. **WORN

  13. FURNITURE

  14. TRASH

  15. **OLDTRAP

  16. CONTAINER

  17. NOTE

  18. DRINK_CON

  19. KEY

  20. FOOD

  21. MONEY

  22. **PEN

  23. BOAT

  24. CORPSE_NPC

  25. CORPSE_PC

  26. FOUNTAIN

  27. PILL

  28. **BLOOD

  29. **BLOODSTAIN

  30. SCRAPS

  31. PIPE

  32. **HERB_CON

  33. HERB

  34. **INCENSE

  35. **FIRE

  36. **BOOK

  37. SWITCH

  38. LEVER

  39. PULLCHAIN

  40. BUTTON

  41. DIAL

  42. **RUNE

  43. **RUNEPOUCH

  44. **MATCH

  45. **TRAP

  46. **MAP

  47. **PORTAL

  48. PAPER

  49. **TINDER

  50. **LOCKPICK

  51. **SPIKE

  52. **DISEASE

  53. **OIL

  54. **FUEL

  55. **EMPTY1

  56. **EMPTY2

  57. MISSILE_WEAPON

  58. PROJECTILE

  59. QUIVER

  60. **SHOVEL

  61. SALVE

  62. **COOK

  63. **KEYRING

  64. **ODOR

I.E. If Objtype($o)==light Is $o a light?

If Objtype($o)==1

Room The room the mobile is in.

If Objval[#]($*)== # Is the value of val[#=Nil,1-5)] of $* equal to #?

ifcheck returns the numeric value of the val# field of

If Cansee($*) Can $* see?

I.E. If Cansee($n) Can the character that activated the trigger see?

If Clantype($*)==# Does $* belong to clan type #?

Clan types:

  1. PLAIN

  2. VAMPIRE

  3. WARRIOR

  4. DRUID

  5. MAGE

  6. CELTIC

  7. THIEF

  8. CLERIC

  9. UNDEAD

  10. CHAOTIC

  11. NEUTRAL

  12. LAWFUL

  13. NOKILL

  14. ORDER

  15. GUILD

I.E. if clantype($n)==13 Is character a member of an order (clan type)

Not sure about the clantype#

 

If Isasupressed($*)==# Is $* asupress timer equal to #

Sample Programs

---------------

Program 1: Basic shopkeeper greet program.

[Comments:]

mpedit joe add greet 100 [Add a 100% greet prog to "Joe" ]

if ispc($n) [Check if triggerer is Player ]

mea $n Greetings $n! [If True: Echo at Player {phrase}]

else [Otherwise ]

say Hello, $I. [If False: say "Hello" to NPC ]

endif [Every "if" MUST have an "endif" ]

Program 2: A simple bribe program.

[Comments:]

mpedit joe add bribe 1000 [Add bribe program, cost 1000 coins]

if ispc($n) [Is it a Player? ]

mea $n Here's your key, $n [True: Echo at Player ]

mpoload 1000 0 [Load object 1000 at level 0 ]

give key $n [Give key to Player ]

else [Otherwise ]

say Thanks for the gold, chump! [False: say phrase ]

endif [Endif to match If ]

Program 3: A simple act program

[Comments:]

mpedit joe add act p heal me [Add act prog triggered by phrase]

if ispc($n) [Is it a Player? ]

if isevil($n) [True: Is player evil? ]

say I don't heal evil people! [True: say phrase ]

else [Otherwise ]

say I will heal you, $n. [Not evil (False): say phrase ]

mpforce $n give 5000 coins joe [Force player give mob 5000 coins]

c 'heal' $n [Cast heal on player ]

else [Otherwise (first if statement) ]

say I don't heal mobs! [Not PC (False): say phrase ]

endif [Endif to match If ]

endif [Endif to match If ]

Program 4: A simple "atmosphere"-type room program

[Comments:]

rpedit add rand 5 [Add a random program - 5% chance]

mpecho The crickets chirp in the grass. [Echo phrase to whole room]

Program 5: A simple Object program

[Comments:]

opedit sword add repair [Add repair program]

mea $n A silver sword says, 'Oh! That's better!' [Echo at Player]

mer $n A silver sword gleams in $n's hand. [Echo around Player]

 

 

The Text/Line Editor

The line editor looks like this:

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

-----------------------------------------------------------------------

>

 

 

The line editor commands are:

/l lists all lines of text

> /l

------------------

1> say hello $n

2> say Everything OK?

------------------

>

/c clears all lines of text from buffer

/i <line#> inserts the text editor before line# and adds one to all following lines

/r <old> <new> global replace

/a abort all changes since buffer was entered for editing

/! <command> execute command (do not use another editing command)

/s save all changes.

 

CREDITS

First of all I am including the following paragraph, taken from MERC 2.2:

The reason this code was written was to enhance the playing experience at ThePrincedom (a Merc 2.0 based world scheduled to open in October 1993)

The original idea for this type of MOBprogram came from playing on: WORLDS of CARNAGE, a dikumud implemented by Robbie Roberts and Aaron Buhr. Aaron (known as Dimwit Flathead the First) was the original author from what I have been told, and I hope he will not be totally offended and angered by