Ansalon
http://www.ansalonmud.com | http://www.ansalonmud.net
telnet://ansalonmud.com:8679 | telnet://ansalonmud.net:8679
telnet://204.209.44.23:8679
Version 2.3.6 April 18, 2014
The object of this document is to help you avoid some of the pitfalls
that many beginning mprog’ers make, myself heavily included.
It exists to be a definitive guide to making mobile programs.
– Skol
How to Begin
MPEDIT CREATE 1234 - makes a new mprog Example: You are working in your new area which has vnum range 1000 - 1100. MPEDIT CREATE 1001
Trigger & Explanations
Commands within Mpedit Explanation
show [ENTER] - shows current MOB program being edited
CODE - Enters code editor
| CODE EDITOR | |
| .r ‘old’ ‘new’ | – replace a substring (requires ”, “”) |
| .r OLD NEW | – Swap a word for a new one |
| .h | – get help (this info) |
| .s | – show string so far |
| .f | – Format (word wrap) string |
| .c | – clear string so far |
| .ld # | – delete line number # |
| .li # (str) | – insert (str) at line # |
| .lr # (str) | – replace line # with (str) |
| @ | – end string |
| done | – exits editor (make sure you exit the code editor with ‘@’ first) |
VARIABLES
NOTE:
To make things come alive, variables are needed. These are represented in the MOBprograms by using a dollar sign convention as in the socials. 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 wont often be used.
| 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 | $l | $m | $M | $L | — | — |
| his/hers/its | $k | $s | $S | $K | — | — |
| a/an | — | — | — | — | $a | $A |
| VARIABLE | Explanation |
| $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 PC in the room with the mobile |
| $R | – the short description, or name and title of the random PC |
| $q | – the name of the MOB PROGRAM target (see MOB REMEMBER) |
| $Q | – the short description of the MOB PROGRAM target |
| $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 |
NOTE:
Also, in if_checks, the accepted variables are the basic ones (i,n,t,r,o,p,q). If a variable is referenced that doesn’t exist, then the value is simply left blank or replaced with “someone”/”something” in output (i.e referring to $o when the trigger is: A kisses B)
If variable $q has not been defined, it is automatically set to the last player that has triggered the program being executed (i.e. variable $n). Once $q has been defined, it can be modified with MOB REMEMBER and MOB FORGET commands in a program. Variable $q lets the mobile “remember” a player across different programs, which can be useful. Note that $q is set automatically only the FIRST TIME the mobile executes a program, every time thereafter it must be set with MOB REMEMBER.
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. But that is a fairly comprehensive trivial twiddle, so we left it the way it is so that, you aren’t forced to make all those twiddles to use the MOBprograms.
| Variable | Argument | Meaning |
| status | if status $1 3 | – is the PC’s status == 3 |
| pc_str | if pc_str $n >= 14 | – is the PC’s strength >= 14 |
| pc_int | if pc_int $n <= 14 | – is the PC’s intelligence <= 14 |
| pc_wis | if pc_wis $n == 14 | – is the PC’s wisdom 14 |
| pc_dex | if pc_dex $n > 14 | – is the PC’s dexterity > 14 |
| pc_con | if pc_con $n < 14 | – is the PC’s constitution < 14 |
| pc_permstr | if pc_permstr $n >= 14 | – is the PC’s PERM strength >= 14 |
| pc_permint | if pc_permint $n <= 14 | – is the PC’s PERM intelligence <= 14 |
| pc_permwis | if pc_permwis $n == 14 | – is the PC’s PERM wisdom 14 |
| pc_permdex | if pc_permdex $n > 14 | – is the PC’s PERM dexterity > 14 |
| pc_permcon | if pc_permcon $n < 14 | – is the PC’s PERM constitution < 14 |
| pc_hours | if pc_hours $n >= 10 | – if the PC has 10 or more hours played |
| pc_weight | if pc_weight $n < 250 | – PC Weight Check, standard operators |
| pc_clanlevel | if pc_clanlevel >= 8 | – Is PC’s clan level over 8? |
| pc_bcopper | if pc_bcopper $n < 250 | – PC Bank Copper check |
| pc_bgold | if pc_bgold $n > 250 | – PC Bank Gold check |
| pc_bsilver | if pc_bsilver $n < 250 | – PC Bank Silver check |
| pc_bsteel | if pc_bsteel $n > 250 | – PC Bank Steel check |
| pc_bplatinum | if pc_bplatinum $n < 2 | – PC Bank Platinum check |
| pc_subclan | if pc_subclan1 $n subclan1 | – Is PC in subclan1? (see subclan list in helpfile) |
| pc_subclan2 | if pc_subclan2 $n subclan2 | – Is PC in subclan2? (see subclan list in helpfile) |
| pc_ispk | if pc_ispk $n | – Is $n (PC’s only) a player killer? |
| pc_god | if pc_god $n Chemosh | – Is the $n (PC’s only) god Chemosh? |
| rand | if rand 30 | – if random number < 30 |
| Subclans: | ||
| dagreen | if dagreen $n | – Dragonarmy and in Green (main or second) |
| dared | if dared $n | – Dragonarmy and in Red (main or second) |
| dablack | if dablack $n | – Dragonarmy and in Black (main or second) |
| dablue | if dablue $n | – Dragonarmy and in Blue (main or second) |
| dawhite | if dawhite $n | – Dragonarmy and in White (main or second) |
| orlouge | if orlouge $n | – Mariner AND Orlouge (main or subclans) |
| bilson | if bilson $n | – Mariner and in Bilson (main or second) |
| clwhite | if clwhite $n | – Conclave AND White (main or subclans) |
| clblack | if clblack $n | – Conclave AND Black (main or subclans) |
| clred | if clred $n | – Conclave AND Red (main or subclans) |
| hodark | if hodark $n | – Holy Order AND Dark (main or sub) |
| hobal | if hobal $n | – Holy Order AND Balance (main or sub) |
| holight | if holight $n | – Holy Order AND Light (main or sub) |
| rose | if rose $n | – Solamnic Rose |
| crown | if crown $n | – Solamnic Crown |
| sword | if sword $n | – Solamnic Sword |
| isnpc | if isnpc $n | – is $n a mobile |
| ispc | if ispc $n | – is $n a pc |
| isgood | if isgood $n | – is $n good |
| isevil | if isevil $n | – is $n evil |
| isneutral | if isneutral $n | – is $n neutral |
| isimmort | if isimmort $n | – is $n immortal |
| ischarm | if ischarm $n | – is $n charmed |
| isfollow | if isfollow $n | – is $n following, or being escorted |
| mobhere | if mobhere fido if mobhere 1233 | – is there a mob name ‘fido’ here – is there mob vnum 1233 here |
| objhere | if objhere bottle if objhere 1233 | – is there a object named ‘bottle’ here – is there obj vnum 1233 here |
| people | if people > 2 | – is there over 2 character in room |
| players | if players > 1 | – does room contain > 1 PCs |
| mobs | if mobs > 2 | – does room contain > 2 mobiles |
| mobexists | if mobexists fido | – is there a fido somewhere |
| objexists | if objexists sword | – is there a sword somewhere |
| clones | if clones > 3 | – are there > 3 mobs of same vnum here |
| order | if order == 0 | – is mob the first in room |
| hour | if hour >= 8 | – is the time after or equal to 8 o’clock |
| isactive | if isactive $n | – is $n’s position != SLEEPING |
| pos | if pos $n standing | – is $n standing |
| language | if language $n human | – is $n’s language human? |
| isdelay | if isdelay $i | – does $i have mobprog pending |
| isvisible | if isvisible $n | – can mob see $n |
| hastarget | if hastarget $i | – does $i have a valid target |
| istarget | if istarget $n | – is $n mob’s target |
| exists | if exists $q | – does $n exist somewhere |
| affected | if affected $n blind | – is $n affected by blind |
| act | if act $i sentinel | – is $i flagged sentinel |
| off | if off $i berserk | – is $i flagged berserk |
| imm | if imm $i fire | – is $i immune to fire |
| carries | if carries $n sword if carries $n 1233 | – does $n have a ‘sword’ – does $n have obj vnum 1233 |
| wears | if wears $n lantern if wears $n 1233 | – is $n wearing a ‘lantern’ – is $n wearing obj vnum 1233 |
| has | if has $n weapon | – does $n have obj of type weapon |
| uses | if uses $n armor | – is $n wearing obj of type armor |
| name | if name $n puff | – is $n’s name ‘puff’ |
| clan | if clan $n ‘whatever’ | – does $n belong to clan ‘whatever’ |
| race | if race $n dragon | – is $n of ‘dragon’ race |
| class | if class $n thief | – is $n a thief (mage, cleric, warrior etc) |
| objtype | if objtype $p scroll | – is $p a scroll |
| vnum | if vnum $i == 1233 | – virtual number check |
| hpcnt | if hpcnt $i > 30 | – if hit points are below 30% |
| room | if room $i == 1233 | – room virtual number |
| sex | if sex $i == 0 | – sex check |
| level | if level $n < 5 | – level check |
| align | if align $n < -1000 | – alignment check |
| money | if money $n | – does $n have X money? |
| objval0 | if objval0 > 1000 | – object value[] checks 0..4 |
| objval1 | if objval1 >= 3 | |
| objval2 | if objval2 != 6 | |
| objval3 | if objval3 > 5 | |
| objval4 | if objval4 < 124 | |
| grpsize | if grpsize $n > 6 | – group size check |
IF_CHECK Full list with Examples & Syntax
Operators

Most of the basic numeric operators are legal and perform the same
function as in C.
Operators:
| == | is equal to |
| != | is NOT equal to |
| > | is greater than |
| < | is less than |
| >= | is greater than or equal to |
| <= | is less than or equal to |
If_Checks In Control Flow (Summary)
![]()
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 (i.e. for an if_check which is referencing a person the only valid variables would be $i, $n, $t, $r or $q) A value type of string is a sequence of characters. It does not need to be included in quotes or anything like that (i.e. if name $n fido ) There are five types of if checks: Type 1: Keyword/value Explanationrand num - Is random percentage less than or equal to num mobhere vnum - Is a NPC with this vnum in the room mobhere name - Is a NPC with this name in the room objhere vnum - Is an object with this vnum in the room objhere name - Is an object with this name in the room mobexists name - Does NPC 'name' exist somewhere in the world objexists name - Does object 'name' exist somewhere in the world Type 2: Keyword/compare/value Explanation
people == integer - Is the number of people in the room equal to integer players == integer - Is the number of PCs in the room equal to integer mobs == integer - Is the number of NPCs in the room equal to integer clones == integer - Is the number of NPCs in the room with the same vnum as the NPC who activated the program equal to integer order == integer - Is the order (of several similar NPCs) of the NPC who activated the trigger equal to integer hour == integer - Is the hour (game time) equal to integer Type 3: Keyword/actor Explanation
isnpc $* - Is $* an NPC ispc $* - Is $* a PC isgood $* - Does $* have a good alignment isneutral $* - Does $* have a neutral alignment isevil $* - Does $* have an evil alignment isimmort $* - Is $* an immortal (level of $* > LEVEL_HERO) ischarm $* - Is $* affected by charm isfollow $* - Is $* a follower with their master in the room isactive $* - Is $*'s position > POS_SLEEPING isdelay $* - Does $* have a delayed MOB PROGRAM pending isvisible $* - Is $* visible to NPC who activated the program hastarget $* - Does $* have a MOB PROGRAM target in the room istarget $* - Is $* the target of NPC who activated the program Type 4: Keyword/actor/value Explanation
affected $* 'affect' - Is $* affected by 'affect' act $* 'act' - Is $*'s ACT bit 'act' set off $* 'off' - Is $*'s OFF bit 'off' set imm $* 'imm' - Is $*'s IMM bit 'imm' set carries $* 'name' - Is $* carrying object 'name' wears $* 'name' - Is $* wearing object 'name' has $* 'type' - Does $* have object of item_type 'type' uses $* 'type' - Is $* wearing object of item_type 'type' name $* 'name' - Is $*'s name 'name' pos $* 'position' - Is $*'s position 'position' (sleeping etc.) clan $* 'name' - Does $* belong to clan 'name' race $* 'name' - Is $* of race 'name' class $* 'name' - Is $*'s class 'name' objtype $* 'type' - Is $*'s item_type 'type' Type 5: Keyword, actor, comparison and value
vnum $* == integer - Is $*'s virtual number equal to integer hpcnt $* == integer - Is $*'s hitpoint percentage equal to integer room $* == integer - Is vnum of the room $* is in equal to integer sex $* == integer - Is $*'s sex equal to integer level $* == integer - Is $*'s level equal to integer align $* == integer - Is $*'s alignment equal to integer money $* == integer - Does $* have money (in gold) equal to integer objval# $* == integer - Is $*->value[#] equal to integer (# from 0-4) NOTE: The original MERC 2.2 MOBprograms used parenthesis '(' and ')' around variables. In this version, they are NOT allowed. Also, parameters MUST BE separated with spaces (Correct syntax is: if level $n < 10).
Mob Command List
Each MOBcommand must be preceeded by "MOB" For Example: MOB ECHOAT $n [string]
MOB Command argument_list Explanation
![]()
MLOAD (mobile) – Lets the mobile load another mobile.
OLOAD (obj vnum) (level) (location) – Lets the mobile load an object
2ND ARGUMENT
# – the level to load the object at
Use 0 if you wish to continue building.
3RD ARGUMENT
None – inventory
R – in room (can also use Room)
W – on mob (must be hold/wearable)
KILL (victim) – Lets the mobile kill any player or mobile
without murder
ASSIST (victim) – Lets the mobile assist another mob or player
MPDUMP 1234 – Displays the source code of a given MOB PROGRAM
ECHO (text_string) – Prints the message to the room at large
ECHOAT (victim) [string] – Prints the message to only the victim
ECHOAROUND (victim) [string] – Prints the message to everyone in the room other
VECHO (room vnum> [string] – Echo a string at a specific room
MVECHO (vnum vnum> [string] – Echo a string at a specific RANGE of rooms
GECHO (text_string) – Prints the argument to all active players
ZECHO (text_string) – Prints the argument to all players in the
same area as the mob
ASOUND (text_string) – Prints the argument to all the rooms around the mobile
than the mob and victim
PURGE (target) – Lets the mobile purge all objects and other
npcs in the room, or purge a specified object
or mob in the room. The mobile can
purge itself, but it must be the last command.
GOTO (dest) – Lets the mobile goto any location it wishes
that is not private.
AT (location) [commands] – Lets the mobile do a command at another location.
TRANSFER (target|’all’) [location]- Lets the mobile transfer people. The ‘all’
argument transfers everyone in the current
room to the specified location
(room vnum or mobile name)
SLIP (target|’all’) [location]- Lets the mobile slip people. The ‘all’
argument transfers everyone in the current
room to the specified location
(room vnum or mobile name)
NOTE: This is a transfer, but there is no
‘look’ so the PC won’t know it happened.
GRTRANSFER (victim) [location] – Lets the mobile transfer all chars in same group
as the victim.
OTRANSFER (item name) [location] – Lets the mobile to transfer an object. The object
must be in the same room with the mobile.
REMOVE (victim) [object vnum|’all’]- Lets the mobile to strip an object or all objects
from the victim. Useful for removing e.g.
quest objects from a character.
JUNK (object) – Lets the mobile destroy an object in
its inventory
– it can also destroy a worn object and
it can destroy items using all.xxxxx
or just plain all of them
FORCE (victim) [commands] – Lets the mobile force someone to do something.
Must be mortal level and the all argument only
affects those in the room with the mobile.
GFORCE (victim) [commands] – Lets the mobile force a group something. Must be
mortal level.
VFORCE 1234 [commands] – Forces all mobiles of certain vnum to do something
CAST (spell) [target] – Lets the mobile cast spells —
Beware: this does only crude checking on the target
validity and does not account for mana etc., so
you should do all the necessary checking in your
mob program before issuing this cmd!
DAMAGE (victim) [min] [max] (kill)- Lets mob cause unconditional damage to someone.
Nasty, use with caution. Also, this is silent, you must show your own damage message. If kill parameter is omitted, this command is “safe” and will not kill the victim. REMEMBER (victim) – Lets the mobile to remember a target. The target can
be referred to with $q and $Q codes in MOBprograms. See also “mob forget”.
FORGET (victim) – Reverse of “mob remember”.
DELAY (pulses) – Sets a delay for MOB PROGRAM execution. When the delay time expires, the mobile is checked for a mob program with DELAY trigger, and if one is
found, it is executed. Delay is counted in PULSE_MOBILE
CANCEL – Reverse of “mob delay”, deactivates the timer.
CALL [vnum] [victim|’null’] [object1|’null’] [object2|’null’] – Lets the mobile to call another MOB PROGRAM withing a MOB PROGRAM. This is a crude way to implement subroutines/functions. Beware of nested loops and unwanted triggerings… Stack usage might be a problem. Characters and objects referred to must be in the same room with the mobile.
FLEE – Forces the mobile to flee.
STATUS – An integar the mob can set/change on itself.
PORTALTO (vnum to) (portal used)- This command let’s a mob create a portal
between the room it’s in, and the room you specify (if you specify a portal then it uses THAT one, so you can use a specific gangplank, door etc).
CREATE – Used to create random objects, amounts of money or gems as rewards for quests.
GOTORESET No argument used, this will take the mob back to
the room that it loaded in, it’s reset room.
MOBcommands are special commands that allow mobiles to perform
immortal-like actions within a MOB PROGRAM (transferring players
or loading items, for example). Most MOBcommands them are wiz
commands which have been changed to allow for mobiles to perform
the commands. In this version of MOBprograms, players have been
prevented from using these commands by adding a separate
interpreter for MOBcommands. This also speeds up (in most cases)
MOB PROGRAM execution when MOBcommands are used. All MOBcommands
are preceded with the word ‘MOB’ on the command line.
MOB STATUS [int]
NOTE:
STATUS lets you put mobiles in different states, this is
simply an integar you attach to them, and can check on them.
Syntax Example:
if STATUS $i == 0
say My status is 0, going to 1
MOB STATUS 1
end
endif
if STATUS $i == 1
say My STATUS is 1, going to 2
MOB STATUS 2
end
endif
if STATUS $i == 2
say My STATUS is 2, going to 0
MOB STATUS 0
end
endif
end
Note: (the ‘end’ in each check, good thing, or the mob will keep going)
This command can make the mob MUCH more intelligent to react with.
Many thanks to Tyche.
MOB ASOUND [string]
MOB ZECHO [string]
MOB GECHO [string]
NOTE:
ASOUND prints the text string to the rooms around the mobile in
the same manner as a death cry. This is really useful for
powerful aggressives and is also nice for wandering minstrels or
mobiles like that in concept. (Or certain gnomish contraptions ;0)
ZECHO prints the string to all players in the same area with the
mobile. Short for Zone Echo.
GECHO prints the string to all players in the game. Short for Global Echo.
MOB ECHO [string]
MOB ECHOAT [victim] [string]
MOB ECHOAROUND [victim] [string]
Note:
ECHO displays the string to everyone in the room.
ECHOAT displays the string to the victim only.
ECHOAROUND displays the string to everyone except the victim.
The three options let you tailor the message to goto victims or
to do things sneaky like having a merchant do: mob at guard mob
echoat guard rescue_please This coupled with a guard act trigger
on rescue_please to: mob goto $n mob echo $I has arrived. It is
an affective way of quickly bringing guards to the scene of an
attack. (Note that the merchant has to be the only one of its
kind in the game or have a unique name, otherwise the guard
might go to different mobile…).
MOB MLOAD [vnum]
MOB OLOAD [vnum] {‘room’|’wear’}
(without second argument, loads in inventory)
IE: MOB OLOAD 16203 0 WEAR // Loads it, wears It if it can
IE: MOB OLOAD 16203 0 ROOM // Loads it in the ROOM
IE: MOB OLOAD 16203 0 NONE // Loads it in inventory
Note:
MLOAD creates a mobile and places it in the same room with the
mobile. OLOAD loads the object into the inventory of the mobile.
Even if the item is non-takable, the mobile will receive it in
the inventory. This lets a mobile distribute a quest item or
load a key or something. The optional 3rd parameter can be
specified; ‘room’ means to load the object to the room, ‘wear’
means to force the mobile to wear the object loaded (useful for
equipping mobiles on the fly).
MOB KILL [victim]
Note:
Lets a mobile kill a player without having to murder. Many
MOBprograms end up with mob kill $n commands floating around. It
works on both mobiles and players.
MOB FLEE
Note:
Causes a mobile to unconditionally flee from combat. Can be used
for example with the hit point percentage trigger to simulate
“wimpy” behavior.
MOB REMOVE [victim] [vnum|’all’]
Note:
Lets the mobile to strip an object of given vnum from the
victim. Objects removed are destroyed. If the vnum is replaced
with “all”, the whole inventory of the victim is destroyed. This
command is probably most useful for extracting quest items from
a player after a quest has been completed.
MOB JUNK [object]
Note:
Destroys the object referred to in the mobile’s inventory. It
prints no message to the world and 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 (have a
MOB PROGRAM trigger on the ‘full inventory’)
MOB PURGE [argument]
Note:
Destroys the argument from the room of the mobile. Without an
argument the result is the cleansing of all NPC’s and items from
the room with the exception of the mobile itself. However,
mppurge $i will indeed purge the mobile, 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 and bad things
happen.
MOB AT [location] [command]
Note:
Performs the command at the designated location. Very useful for
doing magic slight of hand tricks that leave players dumbfounded..
such as metamorphing mobiles, or guard summoning, or corpse
vanishing.
MOB GOTO [location]
Note:
Moves the mobile to the room or mobile or object requested. It
makes no message of its departure or of its entrance, so these
must be supplied with echo commands if they are desired.
MOB TRANSFER [victim/’all’] [location]
MOB GTRANSFER [victim] [location]
MOB OTRANSFER [object] [location]
Note:
Sends the victim to the destination or to the room of the mobile
as a default. if the victim is “all” then all the characters in
the room of the mobile are transferred to the destination. Good
for starting quests or things like that. There is no message
given to the player that it has been transferred and the player
doesn’t do a look at the new room unless the mob forces them to.
Gtransfer works like transfer, except that the group the victim
belongs to is transferred with the victim. Otransfer
transfers an object in the room.
MOB FORCE [victim/’all’] [command]
MOB GFORCE [victim] [command]
MOB VFORCE [vnum] [command] ***** Didn’t seem to work on Ansalon
Note:
Forces the victim to do the designated command. The victim is
not told that they are forced, they just do the command so
usually some MOB ECHO message is nice. You can force players to
remove belongings and give them to you, etc. The player sees
the normal command messages (such as removing the item and
giving it away in the above example) Again, if the victim is
“all” then everyone in the mobiles room does the command. Gforce
works like force except that it affects the group the victim
belongs to.
Vforce affects all mobiles with given vnum in the game world.
This is useful for, for example, purging certain type of NPCs
from the game (by forcing them to purge themselves).
MOB CAST [spell] [victim]
Note:
Lets the mobile to cast spells. Beware, this does only crude
validity checking and does not use up any mana. All spells are
available regardless of the race or other abilities of the
mobile. Casting the spell occurs silently, but spell effects are
displayed normally.
MOB DAMAGE [victim/’all’] [min] [max] {lethal}
Note:
Causes unconditional damage to the victim. Specifying “all” as
victim causes damage to all characters in the room except the
mobile. Min and max parameters define the minimum and maximum
amounts of damage caused. By default, the damage is non-lethal,
but by supplying the optional ‘lethal’ parameter, the damage can
kill the victim. This command is silent, you must echo all
messages yourself in the program. Useful for implementing
special attacks for mobiles.
MOB DELAY
MOB CANCEL
Note:
MOB DELAY sets the time in PULSE_MOBILE after which the mobile’s
delay trigger is activated. If the mobile has a program defined
for delay trigger, the program is executed when the timer expires.
MOB CANCEL resets the delay timer.
MOB REMEMBER [victim]
MOB FORGET
Note:
This command enables the mobile to remember a player for future
reference in a MOB PROGRAM. The player can subsequently be
referred as ‘$q’ in programs activated by the mobile. MOB FORGET
clears the target. Note that if the first time the mobile runs a
program, $q is automatically set to the player who triggered the
event. Most commonly this command is used in delayed programs,
where the mobile has to remember the player who triggered the
original event, for example to continue conversation.
MOB CALL [vnum] {victim} {target1} {target2}
Note:
This command lets you call MOBprograms from within a running
one, i.e. to call a MOB PROGRAM subroutine. The first parameter
is the vnum of the program to execute, the second is the
victim’s name (for example $n), and the third and fourth are
optional object names. All other parameters except vnum can be
replaced with word ‘null’ indicating ignored parameter.
MOBprograms can be called recursively, but as a safety measure,
parser allows only 5 recursions (unless altered).
MOB PORTALTO [vnum][portal vnum]
Note:
This command lets mobs link areas with portals, if you don’t
specify a portal (or use #25) it will vape in 10 ticks.
Example: We have a new gangplank portal named gangplank trsgp
(Pick a UNIQUE name if you want the mob to be able to find/purge old ones)
if objexists trsgp
mob at trsgp mob purge trsgp
endif
if objexists trsgp
mob at trsgp mob purge trsgp
endif
say Thanks, we're just arriving at the docks of Caergoth now!
mob portalto 16200 13610
mob echo A sailor pushes a gangplank off the stern onto the docks at Caergoth.
mob vecho 16200 A sailor ties off the Percheron and pushes a gangplank to the dock.
mob junk ticket
MOB CREATE $n [type] [arguments]
Note: Types are equip, money or gem and arguments for each are below:
equip : green, red, white
gem: diamond, ruby, emerald, opal, pearl, garnet
money: low value, high value
Example: You can have a miniquest mob generate random prizes now.
if $N has questobject
say Thank you so much for completing the quest $n!
mob junk questobject
mob create $n equip green
mob create $n money 250 350
mob create $n gem garnet
endif
Commands within Medit (while editing a mob, AFTER mprog created)
addmprog [vnum] [trigger] [phrase]
Example: (with a mob being edited)(medit)
addmprog 13456 greet 80 – This adds mprog 13456 to the mobile,
which greets pc’s when they enter
80% of the time.
delmprog 0 (or 1,2,3 etc) – removes an mprog from a mob.
NOTE:
[vnum] The vnum of the mob program (mpedit)
[trigger] List of valid triggers and explanations above
[phrase] A single word, or a phrase within quotes
(example: “looks at you” or “yes” etc)
Or a percentile (ie ’80’ happens 80% of the time)
Loading Mobiles and Objects
No doubt you want to load objects and mobiles in your MOBprograms
with “mob oload” and “mob mload”. There are two problems connected
to this. One is that mloaded mobiles will appear without equipment
and the other is that it is difficult to keep track of the number of
created mobiles and objects.
If you want to mobiles to appear in your area as a result of the
players’ action, create a “storage room”. Define resets for the
mobiles as usual (equipment etc.) and place them in the storage
room. When you need to use the mobiles, just “mob transfer” them to
the location you want. This is better than creating mobiles on the
fly, since you don’t have to worry about creating too many mobiles
or equipping them, area resets take care of all that.
If you have a MOB PROGRAM that creates new mobiles, you might want
to make the mobiles “self-destructing”. This is easiest to do with a
random trigger that checks if the mobile is doing anything useful
and possibly does ‘mob purge $i’.
Another possibility is to use a “purgemaster”. Create a storage room
with a single mobile. Attach a random trigger that does ‘mob purge’
to that mobile. Now, when you need to get rid of anything, just ‘mob
transfer’ the mobile or item to purgemaster, and it will be
destroyed sometime later.
Miscellaneous Information
There is really no limit to the number of MOBprograms a given mobile
can have. However, the length of a single command block is limited
by the value of MAX_STRING_LENGTH. In my version it was around 4k,
so that is probably about 100 lines. The indentation spaces shown
in the example above are NOT required, but do make it easier to read
(and debug). HOWEVER, all spaces and indentations are loaded into
memory as a part of the program, so you’re using up memory.
Memory usage can also be reduced by using subroutines
(see MOB CALL).
It IS possible to accidentally make mobiles which can trigger in
loops. Infinite loops have been prevented, but in case of a loop,
the mobile behavior is undefined. An example of a looping action
would be using a RANDOM mprog with an UPDATE_ALWAYS mob, this
doesn’t actually loop, but may cause this error:
[*****] BUG: MOBprogs: MAX_CALL_LEVEL exceeded, vnum #
(note: vnum refers to calling mob’s vnum NOT mprog vnum)
this is when too many mprogs are being called simultaneously, and
the rom can’t deal with them, happens with UPDATE_ALWAYS and RANDOM
trigger combinations, especially when there are 20 of the mob, each
with 3 random mprogs each, you do the math.
The list of variables and triggers and if_checks will grow
continuously as mud creators demand the ability to do certain
things. If you have a request or if you have a new one, I don’t mind
hearing about them, and if you find bugs, I shall gladly attempt to
squash them for you. As additions or fixes are made, the code will
occasionally be redistributed. However, if you want a current
version, please feel free to ask. When the code is redistributed, a
file containing the change history from the original release will be
provided (when possible) to allow you to patch in the changes with
low grief.
– Note: Who do we call again? If someone knows, please let the
immortal staff know.
CREDITS
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 MOB PROGRAM came from playing on:
WORLDS of CARNAGE, a DIKU MUD 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 visible 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
natasha@gs118.sp.cs.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 4th Realm crew for
extensively testing MOB PROGRAM 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
MORE CREDITS
This text was compiled from several mob prog/mpedit texts in order to give you
a more complete guide to mob progs in Ansalon (Rom 2.4 based in 1996) The
previous credits/copyrights are for the ‘extended’ or ‘more info’ parts which
I added to the existing document to further explain functions/syntax etc.
Other notes and examples added from my trials in CRASHING MUD! As I rewrite
code and write better explanations of how to use the different aspects of
mobprogs, they are updated here.
Zivilyn aka Skol December 10th, 2001 – Jul 11th, 2008
Ansalon
This document was created for use with Ansalon, ROM 2.4 and OLC on…
http://www.ansalonmud.com
http://www.ansalonmud.net
telnet://ansalonmud.com:8679
telnet://ansalonmud.net:8679
Version 2.3.3 July 16, 2008
PS. If you run into questions/scenario’s not handled here, feel
free to talk with me about them. If they are something that
needs to be added or discussed, I’ll be happy to do so. – Skol.
