Creating Programs

From dodWiki

Jump to: navigation, search

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.

Contents

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 * refers to m for mob, o for object, or r for room - mpedit/opedit/rpedit.)

*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 * refers to m for mob, o for object, or r for room.)

Mpstat/Opstat

*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. #This shows the basic mob information.
Short description: the guard.
Long description: A guard patrols the streets of the city.
Hp: 495/495. Mana: 100/100. Move: 100/100.
Lv: 16. Class: 3. Align: 1000. AC: -61. Gold: 500. Exp: 0.
>greet_prog 2     #Program #1
say hello $n
say Everything OK?
>greet_prog 2     #Program #2
smile $n
emote tips his helm.
say Good day to you $n.
>rand_prog 2      #Program #3
emote looks at the sky.
say Looks like we're gonna get some rain soon.
>rand_prog 2      #Program #4
emote Whistles a cheerful little ditty as he walks by on patrol.

Rpstat

This command displays all of the room programs that have been written for a room. You must be standing in the room to use this command.

Example:

rpstat

Name: Inside the Western Gate. Vnum: 21088.           #Room info
>rand_prog 5                                          #Room program #1
mpecho An eerie howling can be heard in the distance.

Setting up programs

Program syntax is as follows.

First, let's 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:

  • 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.

</FONT>


ACT

Room/Mob

act [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. However, punctuation is important.

act 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 is considered to be a phrase.

act 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 p pokes you in the rib.

Would only trigger on the phrase "pokes you in the rib". "pokes you in the ribs" Would not trigger. The period prevents things like keyword "hi" activating when the word "this" has been used.

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 won't as well).

That said, it currently doesn't get triggered by echoes (echo, mpecho, mpechoat, mpechoaround, mpasound). Also, contrary to the help file, it doesn't seem to be triggering on emotes, either.

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.

For mobs, 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.

For rooms and objects, there must be a PC present in the room for the trigger to be checked.

This trigger is useful to give some mood to a room or a bit of personality to the game. 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% willalways 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 too 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.

**NOTE** Having the mob 'drop' and 'get' the coins will turn it into cash and add it to the mob's gold.


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

(aka RPCOMMANDS, OPCOMMANDS)

I've never personally had to use anything other than mpcommands, but have included rpcommands and opcommands (for rooms and objects 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 list of commands can be used for Room, Mob and Object programs. The commands listed at the bottom are for mob programs only.

Commands: (parameters)

Mobs only:

**These mpcommands really shouldn't be used

MPDAMAGE

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

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

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

mpslay <victim>

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

MPASOUND

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 nice for wandering minstrels.

MPECHO

mpecho <phrase>
mpe <phrase>

Displays <phrase> to the entire room.

MPECHOAT

mpechoat <name> <phrase>
mea <name> <phrase>

Displays a phrase to only the victim.

MPECHOAROUND

mpechoaround <victim> <phrase>
mer <victim> <phrase>

Displays a phrase to all in the room except victim.

Echo colors

The following 16 colors are supported in the commands echo, recho (room echo), mpecho, mpechoat, and mpechoaround.

**When choosing a color, remember that not everyone sees screen colors as you do.**
**Also note, these are different from the prompt colors. Prompt colors will not work in echo commands.**

Code Color Code Color
whi White (Default Color) TBD
yel Yellow TBD
blu Blue TBD
dbl Dark Blue TBD
lbl Light Blue TBD
cya Cyan TBD
gre Green TBD
dgr Dark Green TBD
cha Charcoal (Grey) TBD
dch Dark Charcoal (Dark Grey) TBD
pur Purple (Magenta) TBD
red Red TBD
ora Orange TBD
bro Brown TBD
pin Pink TBD
bla Black TBD

An underscore _ precedes the color.

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

To save line space, you only need to enter as much of the color indicator as required to uniquely identify it, usually three letters.

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

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

mpdream <victim> <phrase>

Sends a message to a sleeping character.

MPJUNK

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

mpmload <vnum> [level]

Example:
mpmload 1000 20
(Invoke mob 1000 at level 20)
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

mppurge <object/mobile>

Examples:
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

mptransfer <victim> <location>

Examples:
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

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).

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 #:

Direction Value
NORTH 0
EAST 1
SOUTH 2
WEST 3
UP 4
DOWN 5
NORTHEAST 6
NORTHWEST 7
SOUTHEAST 8
SOUTHWEST 9
SOMEWHERE 10

MPKILL

(Mob only)

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)

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)

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)

mpadvance <name> <level> 

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

MPPKSET

(Should not be used)

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

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.

MPDEPOSIT, MPWITHDRAW

mpdeposit <amount>
mpwithdraw <amount>

This command orders the mobile to deposit or withdraw a specified number of coins from an area. These can be used in conjunction with mpat to tell the mob which area to withdraw/deposit money in.

Example:

mpat 21000 mpwithdraw 5000000

This would cause the mob to withdraw 5 million coins from the Arravale area, as that is the area vnum 21000 is in.

If no mpat is used, the mob will withdraw or deposit the money in the area in which it is located at the time.

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

Main article: If checks


'If checks' are the primary means by which MUD programs perform if-then-else statements. A variety of 'if' conditions are built into SMAUG and can be tested using 'if checks'. Most are fairly obvious, but some of the more obtuse deserve a slight explanation.

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:

  • Enter text here

/l lists all lines of text

> /l

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

1> say hello $n

2> say Everything OK?

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

>

/c clears all lines of text from buffer

/d [line #] deletes specific line# from buffer (if line# not specified last line in buffer will be deleted)

/d 1 would delete "1> say hello $n" and line 2 would become line 1

/g <line#> moves > to specified line# and delete text (after line has been edited, the > automaticly goes to a new line at end of buffer)

/g 1 would move > to line 1 and erase the text there

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

/i 1 would insert a blank line and make that line 1, line one becomes line 2, and line 2 becomes line 3, etc.

/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 my coding and sharing a mimicked version with the world. This version is probably not as good as the original and I do feel remorse for publishing the idea. However, since Carnage has been down for months without a word of information regarding its return, I am glad to let one of the best features live on in future generations of MUDs.

There are no objections to this code being shared, since, aside from a nuclear destruction of all the Temples of Midgaard (excepting the original one!!), bland mobiles are the greatest bane of Dikumuds today. It would be nice to get a message saying you are using the code just for our references. We shant answer questions from anyone until told where they are using the code. *grin* Since this code is not copyrighted, you of course dont have to do anything we say, but it would be nice of you to put the mobprog help screen into your database. and have mobinfo show up somewhere on a more visable help screen (possibly tagged onto the bottom of credits as a see also...)

I acknowledge all the work done by the original Diku authors as well as those at Merc Industries and appreciate their willingness to share code. Also, quick thanks to Wraith for doing a little beta-installation testing.

N'Atas-Ha - June, 1993
murph@ri.cmu.edu

In addition to this DOC file credit section, I'd like to add a thank you to Yaz, Mahatma, Zelda, and the rest of the Marble Mud crew for extensively testing MOBProgram 2.1 for me. You may see MOBPrograms in action as well as their own "flavor" of mud at marble.bu.edu 4000.

Kahn - Oct 28th, 1993
MERC Industries

I have ported this code to CircleMud 2.20 and this DOC file was modified slightly to include information correct with regards to that version of the code. A lot of the references to Merc Specific features or internals were removed. I am indebted however to the MERC Industries folks for providing it in the first place.

Moonchilde - Jun 14th, 1994
jtraub@zso.dec.com

 

Kahn-Oct 28th, 1993

MERC Industries

(Bless Merc for the mobprogram.)

Next, I really thank Herne the Hunter for the original help files that I used to create my own help.

And Tank, the original author of this document.

If you would like credit please state the name you want credited, a link to a webpage , email, a mud where you build, and/or its telnet address. You may use any combination you desire. Samples and tips without this information will be listed as anonymous.



Personal tools