Written by Joran Jessurun (Fatal) for Fatal Dimensions.
A mob can be associated with one mobprog. This is done in the mob editor with the procinstance command. When a mobile is created, this program will be executed. When a mob is extracted (purged / removed from game) all variables and procedures created by the mobprog will be deleted.
A mobprog will normally contain some definitions for procedures (using the TCL proc command) and at least one call to the addtrigger command. The addtrigger command will let the mob react on certain events by calling a mobprog.
A small example for a mobprog:
proc greetplayer {} { ! say "Hello [char short], how are you today?" ! tip [char] } addtrigger 1 greet {greetplayer} {trig true}
This small mobprogam will be executed when the mob associated with this mobprogam is loaded (with load mob command or a reset). It will define a procedure that greets the default character and tipping its hat to him/her. Finally it will add a greet trigger. The name of that trigger is 1. This can be used to delete the trigger dynamically (not often used). A greet trigger is a trigger that will go off when a player enters the room. The last argument of a trigger is an extra condition that should be valid before the trigger executes. Here {trig true} is used, meaning that this trigger will always occur. If it had been {trig chance 40} there only is a 40% chance the trigger will occur. If the trigger fires it executes the {greetplayer} command, defined earlier.
When a trigger executes the mob, char, room and obj command will refer to the default.
The mud and random commands do not have any special mud structures associated with them.
charid's, objid's and locations can be used as parameters for the commands.
The following paragraphs will describe the format of these identifiers.
The charid
A charid is a way to identify characters in the mud. This can be one player or one or more mobiles. The charid has the following form:
[options:]<argument>
With the options you can specify how the search must be done. The options are a list of characters. Allowed characters are:
g | Search globally. Default all search actions are only done in the current room. This option makes the system search the whole mud. |
m | Only find mobs. |
p | Only fins PCs. |
v | Use vnum to find a mob |
The <argument> can be a name or an id (number). Every player and mob have an unique id. This can be used to find that character.
A name can haver a prefix like this:
2.janitor
This will search for the second janitor in the room.
m:10 | Mob with id 10 in this room. |
gm:10 | The same mob, but search globally. |
p:123252424 | The player with the given id in current room |
v:3001 | The mob with vnum 3001 in current room |
Test | The mob or player with name Test in current room |
mg:Test | The mob with name test searched globally |
p:Fatal | The player with name Fatal in current room |
mg:3.janitor | The third janitor in the mud |
[options:]<argument>Option letters:
v | Use vnum to find the object. |
t | Use string as object type. |
The argument can be a name or a number. A number indicates the objects unique id. object id's will not be preserved after reboot.
100 | Search for object with id 100 |
v:3001 | Search for object with vnum 3001 |
t:weapon | Search for a weapon |
t:3.weapon | Search for the third weapon |
test | Search for the object named test |
The location is used to find a room in the mud. You can search for room vnum
or a mob or object that is in a room.
[options:]<name> | Search for char or object. |
[options:]<number> | Search for char or object or vnum. (default vnum) |
Option letters:
m | Find only mobs |
p | Find only PC's |
c | Find mobs or PC's. |
o | Don't search for chars, but for objects |
Normally when using a number it will be interpreted as a room vnum. Using the options m, p, c or o it will be interpreted as an id.
Examples:
3001 | Room with vnum 3001 |
m:100 | Room with mob with id 100 |
p:Fatal | The room where Fatal is standing |
o:122 | The room which contains object with id 122. It will only find objects that are lying in the room. |
addtrigger <name> <type> <call> <trigger>
Adds a trigger to the mob. Use <name> to give the trigger an unique name. Non unique names will be rejected. Also numbers are allowed names. This name can be used to delete the trigger later. Type is the trigger type, like "greet", "grall", "bribe", "kill", etc. Trigger types are described later. <call> is an TCL-script that should be executed. Normally this will be the name of a procedure to execute. The <trigger> gives the trigger condition. This should be a TCL command (or script) that returns a boolean. If the boolean is true, the <call> script will be executed.
The <trigger>-script may generate variables that then can be used in the <call> script. The <trigger> script has also access to all other functionality you would normally have in a TCL-mobprog.
Triggers are fairly easy to add, but this basic list should hold for most needs. Their names, argument list syntaxes, and translation into more articulate English are given below. Some triggers generate a trigger value. This value can be accessed with the [trig] command or trough the $::t variable. The trig command has a lot of routines for easy access to these trigger values.
Here's a summary of triggers:
Trigger
ACT
Trigger
SPEECH
Trigger
RANDOM
Trigger
GREET/GREET ALL
Trigger
ENTRY
Trigger
EXIT/EXIT ALL
Trigger
GIVE
Trigger
BRIBE
Trigger
KILL
Trigger
FIGHT
Trigger
HIT POINT PERCENTAGE
Trigger
DEATH
Trigger
DELAY
Trigger
SURRENDER
Trigger
LEAVE/LEAVE ALL
Trigger
TIMER
Trigger
HOUR
Trigger
INTERPRET
Trigger
PREBUY
Trigger
BUY
Trigger
POSTBUY
Trigger ACT
Keyword : 'act'
Trigger
value: The act format string (string)
Default char: The person who did the
act.
The trigger value is the non parsed text string. When someone smiles it would be: $n smiles happily.
NOTE: Most general trigger. 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. Output of "say", "shout" and "emote" do not trigger this event.
Trigger SPEECH
Keyword : 'speech'
Trigger value: The spoken text (string)
Default char: The person who
spoke.
NOTE: This is only triggered when the phrase is contained in a message which has been said by a PC in the same room as the mob. The PC restriction is not necessary, but makes infinite loops between two talking mobiles impossible. It also makes it impossible for two NPC's to stand and discuss the weather however.
Trigger RANDOM
Keyword : 'random'
Trigger value: none
NOTE: This trigger is checked at each PULSE_MOBILE. This will happen even if there is no PC in the room with the mob, but there must be players in the same area. It is useful to give mobiles a bit of a personality. For instance a janitor who stops to spit tobacco, or complain about the hours, or wonder why there are no woman janitors on muds, or a fido which barks or growls or pees on the curb is much more alive than one which just sits there scavenging. Note that this trigger is checked only when there are players in the area. If you want this event to be triggered always, you must set the ACT_UPDATE_ALWAYS flag of the mobile.
Trigger GREET/GREET ALL
Keyword : 'greet'
Trigger value: Exit number (integer)
Default char: The person who
entered the room.
Argument is the exit number (0:north, 1:east, 2:south 3:west etc.)
NOTE: Whenever someone enters the room with the mobile, and the mobile saw the person enter, this is checked. Good for shopkeepers who want to welcome customers, or for pseudo-aggressive mobiles which need to discriminate on who they attack. Greet trigger activates only when the mobile is not busy (fighting, sitting, sleeping etc.). If you want to be sure to catch all players, use grall.
Keyword : 'grall'
Trigger value: none
Default char: The person who
entered the room.
NOTE: Like greet, but it can be triggered even if the mobile didn't see the
arrival (i.e. sneak, invisible, etc) or is busy. Most useful for faking teleport
rooms or for impassable guardians.
Trigger ENTRY
Keyword : 'entry'
Trigger value: none
Default char: none
NOTE: The opposite of greet trigger. Whenever the mobile itself enters a new room, this can be triggered. Useful for looking around, or waving or other things that real PCs do when they arrive at a crowded room.
IMPORTANT: In an entry program, the mobile can only refer to a random PC -- there's no way to know how many PCs exist in the room the mobile enters! Also, you must check visibility of the target in your program.
Trigger EXIT/EXIT ALL
Keyword : 'exit'
Trigger value: Exit number (integer)
Default char: The person who wants
to leave.
Argument is the exit number (0:north, 1:east, 2:south 3:west etc.)
NOTE: The opposite of entry trigger. This is activated when PC tries to leave
a room through an exit indicated by the argument, and the mobile sees the person
leave. Useful for having a single guardian to
watch several exits. An exit
trigger works better than an entry trigger, since you can refer to a specific PC
instead of a random PC. Normally you can use the trig exits command to
check the trigger value.
IMPORTANT: If this event is triggered, the victim will not move through the exit. If necessary, you must move the character yourself in your program (see char goto or char group { char goto <location>}). Also, this event is not triggered when a character flees from combat or the mobile is not in its default position.
Keyword : 'exall'
Trigger value: Exit number (integer)
Default char:
The person who wants to leave.
Argument is the exit number (0:north, 1:east, 2:south 3:west etc.)
The same as exit trigger, but it can be triggered even if the mobile cannot see the person trying to leave the room or if the mobile is busy.
Trigger GIVE
Keyword : 'give'
Trigger
value: none, but the obj command will refer to the object given.
Default
char: The person who gave the object.
Normally you would use the trig give command to check for the object, but you could also write your own TCL-script to check if the object is the one you want.
NOTE: This is triggered whenever something is given to the mobile. Best used for quests. Since the first successful trigger is the only one of this type which is processed, having an "all" argument in the script at the end of the mobprog list is essentially a default response.
Trigger BRIBE
Keyword : 'bribe'
Trigger value: The number of silver pieces given (integer (>0))
Default char: The person who gave the money
NOTE: This trigger is activated whenever money is given to the mobile. Normally you would use the trig compare command to check the amount of money given. Note that if the script is not triggered (because of too little or much money having been given), the mobile still keeps the money...
ROM 2.4 NOTE: Since ROM 2.4 has two different types of currency (gold and
silver coins), for bribe trigger the amount to be given is converted to silver
coins with the rate of 1 gold = 100 silver.
Thus, the number in the argument
should be the expected amount in silver coins.
Trigger KILL
Keyword : 'kill'
Trigger
value: none
Default char: The person who attacked the mob.
NOTE: This trigger is checked whenever a PC attacks the mobile. The check occurs only ONCE, in the beginning of combat. Useful for summoning assistance etc. (See room mload).
Trigger FIGHT
Keyword : 'fight'
Trigger value: none
Default char: The person who is fighting the mob.
NOTE: Useful for giving mobiles combat attitude. It is checked every PULSE_VIOLENCE when the mobile is fighting. Can be used to cast spells (see mob cast), curse at the opponent, or whatever. Only the first successful one will be processed to save time. Also, this means that the mobile wont get lucky and 1. curse, cast a fireball and 2. spit on the player, cast another fireball in the same pulse.
Trigger HIT POINT PERCENTAGE
Keyword :
'hpcnt'
Trigger value: none
Default char: none
NOTE: Is activated at each PULSE_VIOLENCE when the mobile is fighting. The normal use it to use the trig hpcnt command to check if the number of hitpoints of the mobile are below a given percentage. Multiple hpcnt triggers should be listed in increasing order of percent since a 40% will always be activated before a 20% and, only the first successful trigger is performed. (See also mob flee).
Trigger DEATH
Keyword : 'death'
Trigger value: none
Default char: The person who killed the mob. (Well
almost dead now)
NOTE: When the mobile dies the mobile performs the mobprog 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. It could perhaps destroy the items it was holding (see mob remove), or create some (see mob oload), or cast a spell (see mob cast) on the killer and the room, or even goto a new location (see mob goto) and die there (with a text message, the corpse would seem to vanish) The position of the mobile is set to STANDING, and so it can do all the normal commands, without worrying about being DEAD. However, even if the mobile restores itself to full hitpoints, it will still die. This is not a way to immortal mobiles. However, the last thing this mobile does could be to goto some vacant room, load a fresh version of itself, drop all its items, force the new mobile to get all the items and wear them, send the new mobile back to the character who killed it and force the new mobile to attack that character. Along with a text message which said the mobile restored itself, this might be a convincing effect. (Note that your kitten could turn into a dragon this way too).
Trigger DELAY
Keyword : 'delay'
Trigger value: none
Default char: none
NOTE: This trigger activates when the delay of a mobile (set with the mob
delay command) expires. This trigger can be used to create staged mobile
behavior, for example, a guardian could see a
player entering a room, give a
warning and activate a delay. If the player is still present when the delay
expires, the guard would attack the player. (See also mob remember). A
mobile can have several delay triggers, but every time the delay timer expires,
all the triggers are checked and the first successful one executed.
Trigger SURRENDER
Keyword : 'surr'
Trigger value: none
Default char: The person who typed surrender
NOTE: This trigger activates when the mobile is fighting and the opponent issues a "surrender" command. When triggered, both parties will cease fighting, and the mobile can accept the surrender (perhaps taking all equipment from the character with mob remove). Note that if the mobile does not accept the surrender, it must resume fighting with mob kill.If a character surrenders and the mobile does not have a surrender trigger, or the trigger does not activate, the fight resumes normally.
Trigger LEAVE/LEAVE ALL
Keyword : 'leave'
Trigger value: Exit number (integer)
Default char: The person who is
leaving.
Trigger value is the exit number (0:north, 1:east, 2:south 3:west etc.)
NOTE: Works just like the exit trigger, but it doesn't prevent the player from leaving the room.
Keyword : 'leall'
Trigger value: Exit number (integer)
Default char:
The person who is leaving.
Argument is the exit number (0 = north etc.)
The same as leave trigger, but it can be triggered even if the mobile cannot see the person trying to leave the room or if the mobile is busy.
Trigger TIMER
Keyword : 'timer'
Trigger value: Timer value (integer)
Default char: none
Every mob has a timer, this timer can be started with the mob timer command. Normally you issue an mob timer 0 command to let the timer start counting from 0. Every PULSE_SOMETHING the timer trigger is called. You can use trig compare to check the trigger value. A good example of its use can be found in smurf.are.
NOTE: The timer can be started and stopped with the mob timer command.
Trigger HOUR
Keyword : 'hour'
Trigger
value: The hour in the mud (integer)
Default char: none
This trigger is tested every hour in MUD time. The trigger value is the time of day.
NOTE: No mobprogs will be successful when the mobile is charmed (since it has no self volition, it should act like it has none) to protect mobiles which are given special powers from being implemented by a player.
Trigger INTERPRET
Keyword :
'interpret'
Trigger value: The command given by the player.
Default
char: The person who gave the command.
This trigger is tested every time a character is entered a command which couldn't be parsed.
NOTE: But mobs and players can trigger this trigger.
Trigger PREBUY
Keyword : 'prebuy'
Trigger value: none
Default char: The person who wanted to buy something.
This trigger is tested after the normal checks if an object can be bought at the shop and before the haggle and deduction of money. If it returns 'false', the deal is off and the command is finished. If it returns 'true' the objects will be actually bought.
Trigger BUY
Keyword : 'buy'
Trigger
value: the object being bought
Default char: The person who wanted to buy
something.
This trigger is tested with just before the object is transfered to the player. It can return 0: Player is not allowed to buy it, 1: Player is allowed to buy it and 2: The player is allowed to buy it but the shopkeeper doesn't give it yet.
Trigger POSTBUY
Keyword : 'postbuy'
Trigger value: none Default char: The person who wanted to buy something.
This trigger is tested with just before the end of the command, now this is time to give a receipt or something else.
Default the mob command will use the mob that is running the mobprog. Directly after the mob command you can use switches to search for another mob. It duplicates some of the char commands to make writing mobprogs easier.
mob ?-mob? ?-target? ?-second? ?-last? ?-find <charid>?
<option> ?<arg> <arg> ...?
Switches:
-mob | Execute command on the mob that is running the mobprog (default) |
-target | The remembered mob. (Doesn't work if it is a char) |
-last | Command will be done on the mob that did a command last time |
-second | If secondary char is a mob, this switch can be used to access this char. |
-find <charid> | Execute the command on the mob with the given <charid> |
mob
Returns the mobs name. (Same as mob
name)
mob name
Returns the first name of the mob.
mob id
Returns the id of the mob.
mob fullname
Returns the full name of the mob.
mob short
Returns the short description of the mob
mob delay <number>
Without arguments it
returns the current delay timer. By specifying "cancel" as number the delay is
canceled. With arguments it sets the delay timer. mob delay sets the time in
PULSE_MOBILE after which the mobiles delay trigger is activated. If the mobile
has a program defined for delay trigger, the program is executed when the timer
expires.
mob hasdelay
Returns true if this mob has a mobprog
pending.
mob isactive
Returns true if character isn't sleeping (or
dieing)
mob cansee <charid>
Returns true if the mob
can see charid. This routine will not check if charid is in the
same room as the mob.
mob remember [charid]
This command returns the
remembered target. When giving an charid it remembers this character.
This command enables the mobile to remember a player for future reference in
a mobprog. The player can subsequently be referred as char -target in programs
activated by the mobile. mob forget clears the target. 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 forget
Forgets the remembered char.
mob hastarget
Does this mob have a target?
mob targethere
Returns true if the target of the mob is
in the room of the mob.
mob addtrigger <name> <type>
<call> <trigger>
See addtrigger command
mob deltrigger [-all] [-prefix] [name]
It needs
one ore more arguments. With the -all switch it deletes all triggers from this
mob. You can also give the name of the trigger to delete. With the -prefix
switch you can delete all triggers that are starting with a certain prefix.
mob triggers
Returns a list of triggernames for use with
the trigger command.
mob he
Returns he/she or it depending on sex.
mob him
Returns him/her or it depending on sex.
mob his
Returns his/hers or its depending on sex.
mob timer [value]
Without arguments it returns the
timer setting. With arguments it sets the timer. If argument is cancel the timer
will be stopped.
mob timer value starts the timer at the given value. Every
PULSE_MOBILE the timer will be increased. The timer can be stopped with the mob
timer cancel command. The timer triggers the TIMER triggers. The trigger value
will contain the value of the timer.
mob hastimer
Returns true if this mob has a timer
running.
mob echo <text> [<text> <text>
...]
Sends the text directly to this mob.
mob oload <vnum> [level]
[wear|take]
This command will load object with vnum vnum into
the mobs inventory. If "wear" is specified, the mob will wear the object. The
"take" option is default.
mob kill [charid]
Mob will kill char. With
argument, the mob kills the mobile or char.
mob flee
Causes a mobile to unconditionally flee from
combat. Can be used for example with the hit point percentage trigger to
simulate "wimpy" behavior.
mob extract
Removes this mob from the game. When
executing mob commands will generate error messages most of the time.
mob at <location>
<TCL-script>
Execute TCL program while mob is at
another location. Example:
mob at 3001 { ! smile ! say "Try to catch me!" }
mob goto <location>
The mob goes to the
specified location. No messages are displayed.
mob cast [-noisy] <spell>
[target]
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 when -noisy isn't supplied, but spell effects are
displayed normally.
mob act <to> <format> [arg1]
<arg2> [minposition]
The mob act command will be
the main command for displaying texts. This command will take care of things
like invisibility or blindness. It is wise to use this command for all messages
that contain the mobs name in it. It is the same as the act_new function in the
C code of the mud.
to can have the following values:
toroom |
Send to all chars in room except the mob. |
tonotvict |
Send to all chars in room except the mob and arg2. |
tovict |
Send only to arg2 (and then only if arg2 != mob). Arg2 should be a charid. |
tochar |
Send only to the mob who is calling the command. |
toall |
Send to all chars in the room. |
format This is a format string, with formatting specifications introduced by '$' (just as 'printf' introduces its formatting sequences with '%'). Typically this is a complete sentence with a subject and an object. Normally TCL also expands the $ sequences to variable names. To prevent this always specify the format string between curly brackets { }. Here are all the '$' sequences supported by 'act':
$t |
Result is the arg1 argument interpreted as a string. |
$T |
Result is the arg2 argument interpreted as a string. |
$n |
Result is the name of the mob. If the mob is not visible to the target character, result is the string 'someone'. |
$N |
Result is the name of arg2 (considered as a victim). If arg2 is not visible to the target character, result is the string 'someone'. |
$e |
Result is 'he', 'she', or 'it', depending on the sex of mob. |
$E |
Result is 'he', 'she', or 'it', depending on the sex of arg2 (considered as a victim). |
$m |
Result is 'him', 'her', or 'it', depending on the sex of mob. |
$M |
Result is 'him', 'her', or 'it', depending on the sex of arg2 (considered as a victim). |
$s |
Result is 'his', 'her', or 'its', depending on the sex of mob. |
$S |
Result is 'his', 'her', or 'its', depending on the sex of arg2 (considered as a victim). |
$p |
Result is the short description of arg1 (considered as an object). If arg1 is invisible to the target character, result is the string 'something'. |
$P |
Result is the short description of arg2 (considered as an object). If arg2 is invisible to the target character, result is the string 'something'. |
$d |
Result is the first word in arg2, considered as a string. If arg2 is empty, result is the string 'door'. This is meant for extracting the name from a door's keyword list, but may be used in general for other keyword lists. |
arg1 arg2 The first argument is optional and only has to be supplied when a $ sequence is used that needs the first argument. The second argument must always be supplied. If it isn't needed an empty string can be given.
minposition The message will only be send if the mob has at least the minimum position (optional argument). The positions are:
dead |
|
mort |
|
incap |
|
stun |
|
sleep |
|
rest (default) |
|
sit |
|
fight |
|
stand |
mob assist <charid>
This command will help
the charid in its current fight.
mob hpcnt
Returns percentage of hitpoints left.
mob remove [-all] [objid]
Normally the remove
command removes the object with the given object id from the character. When the
-all switch is given the object with that objectid will be removed and the same
command will be repeated again until no objects are found. If no arguments are
given the command does nothing. If only the -all switch is given, all objects
are removed.
This command removes objects from the inventory as will from the equipment.
mob around <TCL-script>
This command
executes the TCL-script in all surrounding rooms. This will mostly be
used in combination with the act command.
mob impinvis [boolean]
Set the AFF_IMPINVISIBLE
flag. With argument true the impinvisible flag will be set. Otherwise it will be
removed. This command returns the new status of the impinvis flag. Without
arguments it will just return the status.
mob property <key> <type>
[value]
If value is defined, it will set the property
to the character, otherwise it will return the value of the property matching
the specified key/type.
Type can be:
int |
Integer |
char |
Character |
long |
Long int |
bool |
Boolean |
string |
String |
mob position [-text]
Returns the position of the mob.
Using -text it returns a text:
0 |
dead |
1 |
mort |
2 |
incap |
3 |
stun |
4 |
sleep |
5 |
rest |
6 |
sit |
7 |
fight |
8 |
stand |
mob hunt <charid>
Hunts a mob or character.
Returns -1 if not found or when it's here or the numerical value for the exit
(0: north and so on).
mob iscarrying <objid>
Returns true if mob
is carrying object with objid.
mob iswearing <objid>
Returns true if the
mob is wearing the object with given objectid.
Commands that work on mobs characters and player characters. The default character is the character that caused the trigger.
char ?-mob? ?-char? ?-target? ?-last? ?-second? ?-find <charid>? <option> ?<arg> <arg> ...?
Switches:
-mob | Execute command on the mob that is running the mobprog (default) |
-target | The remembered mob. (Doesn't work if it is a char) |
-last | Command will be done on the mob that did a command last time |
-second | Use secondary char if available. |
-find <charid> | Execute the command on the mob with the given <charid> |
-char | Not used |
char
Returns the first name of the mob or the name of the
PC
char name
Returns the first name of the mob or the name
of the PC
char fullname
Returns the full name of the mob or the
name of the PC
char id
Returns the unique identifier for this char.
char nametitle
Returns the name and the title, properly
concatenated.
char short
Returns the short name for mobs or name for
PC's.
char title
Returns only the title.
char isimmortal
Returns true if character is immortal
char isnpc
Returns true if character is a mob
char ispc
Returns true if character is a player
char isgood
Returns true if character is good
char isevil
Returns true if character is evil
char isneutral
Returns true if character is neutral
char ischarmed
Returns true if character is charmed
char follows [-name]
The id of the char who this person
is following. Returns 0 if char isn't following someone. With the -name switch
you can get the name of the player or the first name of the mob the character is
following, or an empty string if he/she isn't following anybody.
char isactive
Returns true if character isn't sleeping
(or dieing)
char hasdelay
Does this char have a mobprog pending? (see
mob delay)
char cansee <charid>
Can this char see
charid
char vnum
Returns the vnum of the mob or 0 for a player.
char hp
Returns the current hitpoints.
char maxhp
Returns the maximum amount of hitpoints.
char move
Returns current movement points.
char maxmove
Returns the maximum amount of movement
points.
char room
Returns the vnum of the room the char stands
in.
char sex
Returns "male", "female" or "it" depending on
the chars sex.
char level
Returns the level of the char.
char align [-text]
Returns the alignment of the char.
When the -text option is given it returns "good", "evil" or "neutral" depending
on the chars alignment.
char money
Returns the number of silver the char has.
char isaff <affect>
Is the char affected by
affect
char aff
Returns a list of all affects on the char.
char remaff <affect>
Removes the affect from
the char. Keep in mind that this is only the flag, the spell is still on the
char.
char isact <act>
Is the act flag set? Uses
different flags for mob or player.
char acts
Returns the list of act flags. Gives different
results for mob or player.
char isoff <off>
Is the off flag set. Uses
different flags for mob or player.
char off
Returns a list of off flags. Gives different
result for mob or players.
char isimm <imm>
Returns a boolean if
immunity flag is set.
char imm
Returns a list of immunities.
char isres <res>
Returns a boolean if the
char is resistant to the given value.
char res
Returns a list of resistant flags.
char isvuln <vuln>
Returns true if the char
is vulnerable to the given flag.
char vuln
Returns a list of vulnerability flags.
char iscarrying <objid>
Returns true if
player is carrying object with objid.
char carries <option>
Returns a list of
objects a character is carrying. Options:
vnum |
Returns a list of vnums |
name |
Returns a list of names |
id |
Returns a list of id's |
char iswearing <objid>
Returns true if the
character is wearing the object with given objectid.
char wears <option>
Returns a list of
objects that the character is wearing. This routines returns a list of
{objid wearloc} lists. Options:
vnum |
Returns a list of vnums |
name |
Returns a list of names |
id |
Returns a list of id's |
char position [-text]
Returns the position of the char.
Using -text it returns a text:
0 |
dead |
1 |
mort |
2 |
incap |
3 |
stun |
4 |
sleep |
5 |
rest |
6 |
sit |
7 |
fight |
8 |
stand |
char clan [-name]
Returns the clan number (or name)
char rank
Returns the rank of the character as a number.
char race
Returns the race of the character as string.
char class
Returns the class of the character as string.
char he
Returns he/she or it depending on sex.
char him
Returns him/her or it depending on sex.
char his
Returns his/hers or its depending on sex.
char echo <text> [text ...]
Sends the
text directly to this char.
char echoaround <text> [text
...]
Send text to everybody in room except for the char itself.
char remove [-all] [objid]
Normally the remove
command removes the object with the given object id from the character. When the
-all switch is given the object with that objectid will be removed and the same
command will be repeated again until no objects are found. If no arguments are
given the command does nothing. If only the -all switch is given, all objects
are removed.
char goto <location>
Char is transfered to
the specified location. Returns previous location (room vnum)
char hpcnt
Returns percentage of hitpoints left
char act <to> <format> [arg1]
<arg2> [minposition]
See mob act.
char group <TCL commands>
The TCL commands
will be executed for all chars that are in the same group and in the same room.
The commands will be executed as if those chars triggered the mobprog. (The
default char will be set to to each group member)
Example:
char group { char goto 3001 }
This will transfer all members of the group that are in the same room to room
3001.
char damage [-lethal] <min>
<max>
Does damage to the character
char property <key> <type>
[value]
If value is defined, it will set the property
to the character, otherwise it will return the value of the property matching
the specified key/type.
Type can be:
int |
Integer |
char |
Character |
long |
Long int |
bool |
Boolean |
string |
String |
This command can be used to get information about an object. Default the commands will work on the object that was used in the trigger.
obj ?-find <objid>? ?-last? ?-obj? ?-second? <option> ?<arg> <arg> ...?
Switches:
-find <objid> | Search for the object with this object id. |
-obj | Unused |
-second | Secondary object of the trigger |
-last | Last object referenced. |
obj
See obj name.
obj name
Returns the first name of this object.
obj fullname
Returns the complete name of this object.
obj id
Returns the unique id of this object
obj vnum
Returns the vnum of this object
obj short
Returns the short description of this object.
obj type
Returns the type of this object.
obj transfer <location>
Transfer an object
to a location. If it is in inventory then it will be removed from the inventory.
obj putin <container>
Puts an object into a
container. This works only if the container is a real container.
obj property <key> <type>
[value]
If value is defined, it will set the property
to the character, otherwise it will return the value of the property matching
the specified key/type.
Type can be:
int |
Integer |
char |
Character |
long |
Long int |
bool |
Boolean |
string |
String |
This command can be used to get information about the area. Default the area where the (mobprog executing) mob is standing will be used.
area ?-vnum <vnum>? ?-last? ?-area? <option> ?<arg> <arg> ...?
Switches:
-vnum <vnum> | The vnum of the area to use the command on |
-last | Use the last area referenced. |
-area | Unused. |
-find <charid> | Use the area the mob or player is standing in. |
-char | |
-second | |
-mob | |
-target |
area
Doesn't do anything.
area echo <text ...>
Sends message to all
players in the area.
This command can be used to get information about the mud.
mud <option> ?<arg> <arg> ...?
mud
See mud name.
mud name
Returns the name of the mud.
mud objexists <objid>
Returns true if object
exists in mud.
mud charexists <charid>
Returns true if
charid is found. (Always global search)
mud finger <name>
Returns a list returning:
{level idle-time email}
mud sun
Returns true or false if it is during days or in
the night and a random one during sun rise and sun set.
mud hour
Returns the hour of time day in local mud time.
mud echo <text> [text text ...]
Sends
a message to all players in the game.
mud allmob <charid> <TCL
commands>
This command will find all mobs with the given char
id and run the TCL command as if they are the mob that is running the mob
program (making it the default mob). No PC's will be used to execute these
commands.
The room will always be viewed in perspective of a char. Default this is the default mob. With the switches you can view the room in the perspective of another char. The room chosen will be the room the char is in. The only way of selecting a room the char is not in is using the -vnum option. Here the chosen char will be used the view the given room. The -last switch will return the last char used for the room commando and the last room.
room ?-mob? ?-char? ?-target? ?-last? ?-second? ?-find <charid>? ?-vnum <vnum>? ?-object <objectid>? <option> ?<arg> <arg> ...?
room
See the room name command.
room name
Returns the name of the room.
room randomchar [-name] [-mob] [-char] <TCL-prog>
Returns a random character id. (-name option is used to return a
random name.) Normally only players will be selected, this can be changed with
the -mob (only mobs) or -char (mob or char) switches. returns 0 if no char has
been found.
When a TCL-script has been added that script will be run, and the selected random char will be the default character. This can be used with the char command or in use with the mob -char or ! -char. When no randomchar has been selected, the script won't be executed at all.
Example:
room randomchar { if {[char isimmortal]} { ! say "Greetings, master [char]" ! bow [char] } else { ! tip [char] } }
room charhere [charid]
Returns true if a char
with given charid is in this room.
room objhere <objid>
Returns true if object
with given objid is in this room. In room means lying on the ground, not in
inventory or equipment.
room chars [-name] <type>
Returns a list of
id's of all characters in the room, type can be mob, PC or char, default is
char.
room count [-vnum <vnum>] [-group] [type]
Returns the number of players or mobs in the room. type is
mob, PC or all. Default is player. For mobs the -vnum switch can be used. If the
-vnum switch is used the mob parameter will be assumed. It overrides the PC as
type. -group returns the number of group members of the char that initiates the
room command.
room echo <text> [text text
...]
Sends the text to everybody in the room.
room mload <vnum>
Load mob with given vnum
into this room.
room oload <vnum> [level]
Load object
with given vnum into this room.
room purge <option>
[objid/charid]
The mob executing the mob program won't be
purged.
Options:
all |
Purge the complete room except calling mob |
mob |
Purge the specified mob. (first one that matches char id) |
obj |
Purge the specified obj. (first one) |
allmob |
Purges all mob with charid |
allobj |
Purges all objects with objid |
room damage [-lethal] [-self] <min> <max>
Does damage to everybody in the room except the char calling the
room command. With -self option the mob also does the damage to himself.
room exit <direction>
Gives all info of the
given direction: {vnumexit doorname keynumber {trap flags}}
room property <key> <type>
[value]
If value is defined, it will set the property
to the character, otherwise it will return the value of the property matching
the specified key/type.
Type can be:
int |
Integer |
char |
Character |
long |
Long int |
bool |
Boolean |
string |
String |
room allpc <TCL-script>
TCL-script
will be executed on all players in room.
Triggers are functions which select if a trigger is triggered. For example, a trigger with "trig true" is always triggered, a trigger with "trig chance 25" has a 25% chance of being triggered.
trigger
See the trig value command.
trig chance <percentage>
A value between 0
and 99 will be rolled. If value is less then percentage this function returns
True, otherwise False.
trig value
Returns the string, text value of this
trigger. If there is no trigger value an error will be generated. The trigger
value is also stored in the global variable $::t. This variable will be empty if
no trigger value is available. Different triggers have different trigger values.
Also a lot of triggers don't have a trigger value at all. The following triggers
have the following trigger values:
speech |
The text spoken. | ||||||||||||
exit, exall, leave, leall |
Number of the exit:
| ||||||||||||
bribe |
The amount of silver given | ||||||||||||
hour |
The hour of the day in the mud. | ||||||||||||
timer |
The current timer value |
trig compare <text>
Can be used for easy
comparisons like:
|
trig comp ==0 meaning [trig value]==0 |
|
trig comp =="test" meaning [trig value]=="test" |
|
trig comp <=26 meaning [trig value]<=26 |
|
trig true Just returns true, to let triggers always be fired. (In the old mobprog system a chance of 100 percent was used) |
trig words <words> [...]
Returns true
if one of the words has been found in the trigger text. Search is done case
independent. Only complete words are found.
Example: The text: This is a test?
trig words this |
returns true |
trig words this a |
returns true |
trig words test? |
returns true |
trig words "this test" |
returns false |
trig words tes |
returns false |
trig wordsand <words> [...]
Returns
true if all the words are found in the trigger text. Order is not important.
Search is done case independent.
The trigger expression trig words key please will return true for the following sentences.
|
Could you give me the key please? |
|
Could you please give me the key? |
|
I want the please key. |
|
Please, could you give me the key. |
trig match <regexp>
Match a simple regular
expression. This is always case insensitive.
trig exits <exit> [exit]
Returns true
if the exit entered is one of the given exits. You may use number or names. This
is normally used in the leave and exit triggers. Example: trig exits
north south west up
trig exits 0 2 3
trig bribe <value>
Returns true if trigger
value is greater or equal then the given value. This is normally used in
the bribe triggers.
trig hpcnt <percentage>
Returns true if the
percentage of hitpoints of the mob is below this percentage. This is normally
used in hpcnt triggers.
trig give <objid>
Returns true if the object
given matches the objid. This trigger doesn't look at the trigger value,
but at the default object. This command is normally used in the give trigger.
trig text1
Returns the $t value from an act trigger.
trig text2
Returns the $T value or $d value from an act
trigger.
These are miscellaneous commands
Examples:
random |
Generates a random number between 0 and 99 |
random 9 |
Generates a random number between 0 and 9 |
random 10 20 |
Generates a random number between 10 and 20 |
room directionname <number>
Returns the
names of the exists represented with the numbers:
0 |
north |
1 |
south |
2 |
east |
3 |
west |
4 |
up |
5 |
down |
These are functions which can be used inside mobprograms, but aren't related to a special piece of the mud. They are defined in the file rom.tcl in the area-directory.
color <colourname>
This returns the right
colour code for a given colourname. Available are: red, green, blue, cyan,
magenta, yellow, white (use capitals for bold colours) and underline, blink,
inverse, strike, black and random
uses memory
Allows you to use the memory-system of the
mob. If you remember something, the key will be increased by one. To clear the
key, use forget. Example:
uses memory proc greet {} { ! say you've entered [memory "[char id]-enter"] and left [memory "[char id]-leave"] times. remember "[char id]-enter" } proc leave {} { remember "[char id]-leave" ! wave [char] } proc boo {} { ! cower [char] forget "[char id]-leave" forget "[char id]-enter" } addtrigger 1 greet {greet} {trig true} addtrigger 2 leave {leave} {trig true} addtrigger 3 speech {boo} {trig words boo}
remember <key>
Remembers a given key. See
uses memory for an example.
forget <key>
Forgets a given key. See
uses memory for an example.
memory <key>
Returns the value of a given
key. See uses memory for an example.