Scriptable

From CoffeeMud Wiki
Jump to: navigation, search
CoffeeMUD
Administrator                                                  Builder                                                              Player
=CoffeeMUD Builder Information=
Praetor     Player Support     Scripting     Races     Commands    Classes     Abilities     Socials     Achievements     Behaviors     Properties     Areas     Rooms     Exits     Items     Mobs     Crafting     Ships     Quests     Zapper Masks
===Scriptable===
Targets: MOBs, Items, Rooms
Parameters: (see below)
Examples: LOAD=progs/mrinfo.script~
Description: This behavior allows the reactions and behaviors of the mob to be scripted. The parameter may be complete scripts, and/or LOAD commands as specified below. If you choose to use a file for your script, then each script command line must be terminated by a linefeed or a semicolon. If you choose to put your entire script into the parameters, you must terminate EVERY line with a semicolon (;).

Multiple scripts with multiple triggers may be included. Each script and trigger must be separated by the ~ character. See examples in the resources/progs directory! Now to the script itself:

The first line must be a trigger word followed by any parameters. Valid triggers and parameters are as follows:

  • LOAD=(SCRIPT PATH) - insert a new script from another file. Ex: LOAD=progs/my.script~
  • GREET_PROG (PCT CHANCE) - When players enter the room, given the chance.
  • ARRIVE_PROG (PCT CHANCE) - When the mob enters a new room, or enters the game.
  • ALL_GREET_PROG (PCT CHANCE) - Same as GREET_PROG, but works with sneakers too.
  • LOGIN_PROG (PCT CHANCE) - When players logs into the game, given the chance.
  • LOGOFF_PROG (PCT CHANCE) - When players log out of the game, given the chance.
  • LEVEL_PROG (PCT CHANCE) - When a player anywhere gains a level, given the chance.
  • SPEECH_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When someone says the words.
  • BRIBE_PROG (AMOUNT OF GOLD) - When the amount or better is given to the monster.
  • GIVE_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When something is given to the monster.
  • RAND_PROG (PCT CHANCE) - Triggers at random, given the chance.
  • ONCE_PROG - Triggers on the first occurrence, but never again (until reset).
  • FIGHT_PROG (PCT CHANCE) - Triggers during combat, given the chance.
  • ENTRY_PROG (PCT CHANCE) - Triggers whenever the monster enters a new room.
  • EXIT_PROG (PCT CHANCE) - Triggers whenever anyone exits the room of the monster.
  • DEATH_PROG - When the monster dies.
  • KILL_PROG - When the monster kills.
  • HITPRCNT_PROG (HP PCT) - When the monster reaches the hit points % remaining.
  • MASK_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When a mob performs an action with these words.
  • IMASK_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When this mob performs an action with these words.
  • REGMASK_PROG (P) (EXACT PHRASE)/(REGULAR EXPRESSION) - When a mob performs an action matching.
  • ACT_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When a mob performs an action with these words.
  • SOCIAL_PROG (SOCIAL NAME) - When a mob performs the given social.
  • CHANNEL_PROG (CHNAME) (P) (A PHRASE)/(ONE OR MORE WORDS) - When channels a message with these words.
  • QUEST_TIME_PROG (QUEST NAME) (TIME LEFT) - When the running quest reaches the number of minutes left.
  • TIME_PROG (LIST OF HOURS) - Mob runs program at listed hours of the day.
  • DAY_PROG (LIST OF DAYS) - Mob runs program at listed days of the month.
  • DELAY_PROG (LOW TICKS) (HIGH TICKS) - Mob runs program at the given interval range.
  • LOOK_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is looked at.
  • LLOOK_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is llooked at.
  • GET_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is gotten.
  • OPEN_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is opened.
  • CLOSE_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is closed.
  • LOCK_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is locked.
  • UNLOCK_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is unlocked.
  • PUT_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is put in something.
  • DROP_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is dropped.
  • REMOVE_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is removed.
  • CONSUME_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is ate/drank.
  • WEAR_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is worn/wielded.
  • DAMAGE_PROG - When damage taken by mob or given by item. Item#2 is the weapon. $g will have the amount.
  • BUY_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is bought (items only).
  • SELL_PROG (P) (A PHRASE)/(ONE OR MORE WORDS) - When matching something is sold.
  • EXECMSG_PROG (MSG CODE) (P) (COMMAND WORDS) - When a msg of type msg code is executed. HELP MSG TYPES.
  • CNCLMSG_PROG (MSG CODE) (P) (COMMAND WORDS) - Before a msg of type msg code is allowed. HELP MSG TYPES.
  • FUNCTION_PROG (FUNCTION NAME) - declares a runnable function, with parms in $g, see MPCALLFUNC.

--- NOTE Phrases for MASK_PROG, GIVE_PROG, GET_PROG, PUT_PROG, REMOVE_PROG, WEAR_PROG, BUY_PROG, SELL_PROG, and SPEECH_PROG must group words and phrases together using the "'" character, for instance 'a phrase' or 'multiple words'. The characteris unnecessary when put around single words 'word'.

--- NOTE If Scriptable is placed on an Item, triggers such as GET_PROG, DROP_PROG, WEAR_PROG, and REMOVE_PROG will only trigger when the scripted item is involved.

--- NOTE MASK_PROG and ACT_PROG will check commands as they appear to the mob with this behavior. Consider perspective, vision, and word tense in light of this fact when wording your masks. For instance, the purchase of a sword in a dark shop may be seen as 'Someone buys something from someone' instead of 'Bob buys a sword from Joe'.

Following this line is your script itself. The commands are as follows:

  • IF/ENDIF/ELSE Conditional evaluations, separated by AND/OR. The IF statement can group conditions with () and use the following functions as part of its evaluation:
    • RAND((% CHANCE)) Random truth
    • HAS((CODE) (ITEM NAME)) if the given mob has the specified item.
    • HASNUM((CODE) (ITEM NAME) == (NUM)) the amount the given mob has of the item.
    • HASTITLE((CODE) (TITLE STR)) if the given mob has the give title.
    • WORN((CODE) (ITEM NAME)) if the given mob wears the specified item.
    • ISNPC((CODE)) if the given mob is a non-player.
    • ISPC((CODE)) if the given mob is a player.
    • ISPKILL((CODE)) if the given mob has playerkill flag on.
    • ISGOOD((CODE)) if the given mob is good.
    • ISNAME((CODE) (WORDS)) if the given item is named with given words.
    • CURRENCY((CODE) == (NAME)) if the native currency of the mob or coins is the name. Where == may be !=.
    • NUMMOBSINAREA((MOB NAME) == (NUM)) if comparison of number of mobs of that name in area. Where == may be !=, ), (, (=, (=.
    • NUMMOBS((MOB NAME) == (NUM)) if comparison of number of mobs of that name in world. Where == may be !=, ), (, (=, (=.
    • NUMRACEINAREA((MOB NAME) == (NUM)) if comparison of number of mobs of that name in area. Where == may be !=, ), (, (=, (=.
    • NUMRACES((MOB NAME) == (NUM)) if comparison of number of mobs of that name in world. Where == may be !=, ), (, (=, (=.
    • ISEVIL((CODE)) if the given mob is evil.
    • ISNEUTRAL((CODE)) if the given mob is neutral.
    • ISFIGHT((CODE)) if the given mob is fighting.
    • ISALIVE((CODE)) if the given mob is alive and available.
    • ISIMMORT((CODE)) if the given mob is an archon.
    • ISCHARMED((CODE)) if the given mob is charmed.
    • STRCONTAINS((STRING) (CODED WORDS)) is string contains coded words. May use "" & ! ) ( ().
    • STAT((CODE) (STAT) == (VALUE)) if the given mob/item has a stat of value, != is also valid.
    • GSTAT((CODE) (STAT) == (VALUE)) like STAT, but player data accessible. See Generic.java.
    • DATETIME((TIME/DAY/ETC) == (VALUE)) like STAT, but player data accessible. Where == may be ), (, !=, )=, or (=.
    • AFFECTED((CODE) (SPELL CLASS)) if the mob is affected by spell.
    • ISBEHAVE((CODE) (BEHAVIOR CLASS)) if the mob has a behavior.
    • ISFOLLOW((CODE)) if the given mob is following someone in the room.
    • ISSERVANT((CODE)) if the given mob is serving someone in the room.
    • HITPRCNT((CODE) == (% HITS)) if the given mob has the pct chance hit points. Where == may be ), (, !=, )=, or (=.
    • HASTATTOO((CODE) (TATTOONAME)) whether the given mob has the given tattoo.
    • INLOCALE((ROOM CLASS)) if the mob is in the given room type.
    • ISBIRTHDAY((CODE)) if the mobs birthday is today.
    • INROOM((ROOM ID/MOB NAME) == (ROOM ID/MOB NAME)) if the mob is in the given room.
    • MOOD((MOB NAME) == (MOOD NAME)) if the mob has a mood, and it is the one specified.
    • ISRECALL((MOB NAME)== (ROOM ID/MOB NAME)) is the mob is from the given room.
    • ISHERE((CODE)) if the mob/item in the same room as the scripted one.
    • INAREA((NAME)) if the scripted mob/item in room named by the parameters.
    • ISLIKE((CODE) (MASK)) if the mob/item meets the given zapper mask. See ZAPPERMASKS for mask syntax
    • ISODD((AMT)) whether the given argument is an odd whole number
    • VAR((CODE) (VAR NAME) == (VALUE)) if the var for the given mob has value. Where == may be !=, ), (, )=, (=.
    • FACTION((CODE) (FACT) == (VALUE)) if the faction for the given mob has value. Where == may be !=, ), (, )=, (=.
    • SEX((CODE) == (M/F/N)) evaluates sex. Where == may also be !=.
    • POSITION((CODE) == (SLEEPING/STANDING/SITTING) Evaluates position.
    • LEVEL((CODE) == (LVL)) evaluates level. Where == may be !=, (, ), )=, (=.
    • MATH((EXPR) == (EXPR)) evaluates expression. Where == may be !=, (, ), )=, (=.
    • QUESTPOINTS((CODE) == (VAL)) evaluates questpoints. Where == may be !=, (, ), )=, (=.
    • QVAR((QUEST) (CODE) == (VAL)) evaluates temp quest vars. Where == may be !=, (, ), )=, (=.
    • TRAINS((CODE) == (VAL)) evaluates trains. Where == may be !=, (, ), )=, (=.
    • PRACS((CODE) == (VAL)) evaluates pracs. Where == may be !=, (, ), )=, (=.
    • CLASS((CODE) == (CLASS NAME)) evaluates class. Where == may be !=.
    • BASECLASS((CODE) == (CLASS NAME)) evaluates base class. Where == may be !=.
    • RACE((CODE) == (RACE NAME)) evaluates race. Where == may be !=.
    • RACECAT((CODE) == (RACE CAT NAME)) evaluates racial category. Where == may be !=.
    • GOLDAMT((CODE) == (AMT)) evaluates base gold or item value. Where == may be !=, ), (, )=, (=.
    • EXP((CODE) == (AMT)) evaluates experience points. Where == may be !=, ), (, )=, (=.
    • VALUE((CODE) (CURRENCY) == (AMT)) evaluates base value in given currency. Where == may be !=, ), (, )=, (=.
    • IPADDRESS((CODE) == (ADDRESS)) evaluates ip address of player. Where == may be !=.
    • QUESTSCRIPTED((CODE) (QUEST NAME)) returns whether the code of the given name has a script from the given quest.
    • QUESTWINNER((CODE) (QUEST NAME)) returns whether the code of the given name has won the given quest.
    • QUESTMOB((NAME) (QUEST NAME)) returns whether the mob of the given name is a mob designated in the given quest.
    • QUESTOBJ((NAME) (QUEST NAME)) returns whether the item of the given name is an item designated in the given quest.
    • QUESTROOM((ROOMID) (QUEST NAME)) returns whether the item of the given name is an item designated in the given quest.
    • ISQUESTMOBALIVE((NAME/NUM) (QUEST NAME)) returns whether the mob, designated in the currently running quest, is alive.
    • ISTIME((HOUR#/DAY/DAWN/DUSK/NIGHT)) returns the time of day, or time region.
    • ISSEASON((WINTER/SPRING/SUMMER/FALL)) returns the season.
    • ISWEATHER((CLEAR/RAIN/SNOW/WINDY/ETC..)) returns the weather
    • ISMOON() returns whether the scriptor can see the moon
    • ISMOON((NEW/WAXCRESCENT/WAXQUARTER/WAXGIBBOUS/FULL/WANEGIBBOUS/ETC..)) check the moon type
    • ISDAY((DAY#)) returns the day of the month.
    • EVAL((CODE) == (VALUE/CODE)) if the code has value. Where == may be !=, ), (, )=, (=.
    • NUMBER((VALUE/CODE)) whether the given code or value is a number.
    • RANDNUM((VALUE) == (MAX VALUE)) how the 1st code compares to rand 1..max code.
    • RAND0NUM((VALUE) == (MAX VALUE)) how the 1st code compares to rand 0..max code-1.
    • ROOMMOB((NUM) (NAME)) whether the NUMth mob in the room is named NAME.
    • ROOMITEM((NUM) (NAME)) whether the NUMth item in the room is named NAME.
    • NUMMOBSROOM((*/NAME) == (NUMBER)) compares the # of named mobs in room. Where == may be !=, ), (, )=, (=.
    • NUMPCSAREA(== (NUMBER)) compares the number of pcs in the area. Where == may be !=, ), (, )=, (=.
    • NUMPCSROOM(== (NUMBER)) compares the number of pcs in the room. Where == may be !=, ), (, )=, (=.
    • EXPLORED((CODE) (AREA/WORLD) == (NUMBER)) check % explored of code mob. Where == may be !=, ), (, )=, (=.
    • NUMITEMSROOM(== (NUMBER)) compares the number of mobs in the room. Where == may be !=, ), (, )=, (=.
    • NUMITEMSMOB((NAME) == (NUMBER)) compares the number of items the mob has. Where == may be !=, ), (, )=, (=.
    • MOBITEM((MOBNAME) (NUM) (NAME)) whether the NUMth item owned by mob mobname is named NAME.
    • INCONTAINER((CODE) (CONTAINER/MOUNT)) whether the item is in container or mount.
    • ISABLE((CODE) (SKILL NAME)) whether the mob has the skill/ability.
    • ISOPEN((CODE/DIRECTION)) whether the container item, or direction name is open.
    • ISLOCKED((CODE/DIRECTION)) whether the container item, or direction name is locked.
    • STRIN((STRING) (STRING)) whether the second string appears as a whole word in the first.
    • CALLFUNC((FUNCTION) (PARM)..) returns whether the FUNCTION_PROG named returns a non-null.
    • DEITY((CODE) == (CLASS NAME)) evaluates a mobs deity. Where == may be !=.
    • CLAN((CODE) == (CLASS NAME)) evaluates a mobs clanid. Where == may be !=.
    • CLANRANK((CODE) == (NUMBER)) evaluates mobs rank. Where == may be !=, (, ), )=, (=.
    • CLANDATA((CLAN) (VAR) == (STRING)) evaluates clan rank. Where == may be !=, (, ), )=, (=.

--- NOTES! The parenthesis are REQUIRED for the above! The brackets should NOT be included, they are there to designate a parameter. Where CODE above is one of the following: $n=source of the action, $i=scripted mob, $t=target, $o=item1, $p=item2, $w=owner of item1, $W=owner of item2.

Now we get to the executed commands. They are as follows:

  • FOR $X = (START) to (FINISH) - loops. X must be 0-9. End with NEXT by itself.
  • SWITCH/CASE/ENDSWITCH - act as a multiple if/elseif/elseif....
  • MPASOUND (TEXT) - a noisy emote that goes to all adjacent rooms.
  • MPECHO (TEXT) - an emote
  • MPSLAY (MOB NAME) - utterly kill the target.
  • MPJUNK (ITEM) - destroy the given item from the monsters inventory.
  • MPMLOAD (MOB NAME) - create an instance of the given mob name.
  • MPOLOAD (ITEM NAME) - create an instanceof the given item, give it to the mob.
  • MPOLOADROOM (ITEM NAME) - create an instanceof the given item, drop it in the room.
  • MPMLOAD FROMFILE (CMARE FILE) (MOB NAME) - create a given mob name from a file.
  • MPOLOAD FROMFILE (CMARE FILE) (ITEM NAME) - create an item from a file, give it to the mob.
  • MPOLOADROOM FROMFILE (CMARE FILE) (ITEM NAME) - create an item from a file, drop it in the room.
  • MPECHOAT (MOB/ROOM/AREA/WORLD) (TEXT) - emote to the given target.
  • MPECHOAROUND (TEXT) - emotes to everyone in room but the source of the trigger.
  • MPCAST (SPELL) (MOB NAME) - casts the given spell at the given target.
  • MPKILL (MOB NAME) - attack the given target.
  • MPEXP (MOB NAME) (EXP or TNL%) - grants amount of exp to mob.
  • MPQUESTPOINTS (MOB NAME) (QPS) - sets mobs amount of questpoints. Prefix QPS with ++ or -- to adjust only.
  • MPTRAINS (MOB NAME) (TRAINS) - sets mobs amount of trains. Prefix TRAINS with ++ or -- to adjust only.
  • MPPRACS (MOB NAME) (PRACS) - sets mobs amount of pracs. Prefix PRACS with ++ or -- to adjust only.
  • MPPURGE (ITEM/MOB NAME) - destroy the given target item or mob.
  • MPUNAFFECT (MOB NAME) (ALL/SKILL NAME)- removes given affects from the mob.
  • MPGOTO (ROOM ID/NAME/DESC) - take the monster to the given room.
  • MPAT (ROOM ID/NAME/DESC) (COMMAND) - do a command at the given room.
  • MPSET (MOB/ITEM) (VAR NAME) (VALUE) - use with care! sets a stat for a mob or item.
  • MPGSET (MOB/ITEM) (VAR NAME) (VALUE) - like MPSET but player data accessible. See GSTAT.
  • MPTRANSFER (ALL/MOB NAME) (ROOM ID/NAME/DESC) - transfer mobs to the given room.
  • MPBEACON (ROOM ID/NAME/DESC) (ALL/MOB NAME) - Makes given room start room for players.
  • MPFORCE (MOB NAME) (COMMAND) - force the given mob to do the given command.
  • MPPROMPT (PC NAME) (VARIABLE NAME) (PROMPT). Store user entered value in variable. See Guide.
  • MPCONFIRM (PC NAME) (VARIABLE NAME) (DEFAULT VALUE) (PROMPT). Y or N. See Guide.
  • MPCHOOSE (PC NAME) (VARIABLE NAME) (CHOICES) (DEFAULT VALUE) (PROMPT). Hotkey choices. See Guide.
  • MPSCRIPT (MOB/ITEM) ((FLAGS)) (SCRIPT) - adds a quest Scriptable to the target, flags GLOBAL INDIVIDUAL SAVABLE EXECUTE.
  • MPSETVAR (MOB NAME) (VAR NAME) (VALUE) - set a variable for the given mob. Value may be ++, --, or preceded by +,-,*,or /.
  • MPENDQUEST (QUEST NAME/MOB NAME) - this command will shutdown the given quest, or remove quest scripts from given mob.
  • MPSTARTQUEST (QUEST NAME) - this command will start the quest of the given name.
  • MPQUESTWIN (MOB NAME) (QUEST NAME) - declares the mob a winner of the given quest.
  • MPSTOP (MOB NAME) - forces mob to stop fighting, or performing common skills.
  • MPCALLFUNC (FUNC NAME) (PARMS...) - executes a FUNCTON_PROG already declared.
  • MPALARM (TICKTIME) (COMMAND) - executes COMMAND after time has elapsed.
  • MPNOTRIGGER (TRIGGER NAME) (MILISECS)- this command will prevent given trigger for given miliseconds.
  • MPFACTION (MOB) (FACTION) (VALUE) - changes faction value for given mob. Value is number, range, or +NUM, --NUM.
  • MPWHILE ((IF CONDITION)) (COMMAND) - repeatedly executes commmand.
  • MPDAMAGE (MOB/ITEM) (MIN) (MAX) (KILL)- does random damage to the target. Kills only when KILL parm given.
  • MPREJUV AREA/ROOM/(ROOMID)/(AREAID) (ITEMS/MOBS) - rejuv dead mobs, lost items from area or room
  • MPRESET AREA/ROOM/(ROOMID)/(AREAID) - reload an area or room from the database
  • MPLOG ERROR/INFO/DEBUG HEADER MESSAGE - add an entry to the coffeemud server log
  • MPCHANNEL (!)(CHANNEL) MESSAGE - send a message to a channel
  • MPTRACKTO (MOB NAME) - forces the mob to track down the given mob.
  • MPWALKTO (MOB NAME) - forces the mob to track down the given mob, land surface only.
  • MPAFFECT (SPELL) (MOB NAME) (PARMS) - automatically casts a spell on a mob.
  • MPBEHAVE (BEHAVIOR) (MOB NAME) (PARMS) - adds a behavior to the mob.
  • MPUNBEHAVE (BEHAVIOR) (MOB NAME) - removes a behavior from a mob.
  • MPTATTOO (MOB) (-)(TATTOONAME) - adds or removes the given tattoo for the mob.
  • MPPLAYERCLASS (MOB) (CCLASS ID) ((LVL))... - changes current char class & optionally level.
  • MPTITLE (MOB) (-) (TITLE) - adds or removes the given title string from the mob.
  • MPENABLE (MOB) (ABILITY NAME) (PROF) (STR) - adds a new skill to the mob, or mods prof. w/++,--.
  • MPDISABLE (MOB) (ABILITY NAME) - removes a skill from the mob.
  • MPSAVEVAR (MOB NAME) (VAR NAME) - saves the variable set using MPSETVAR to the database.
  • MPLOADVAR (MOB NAME) (VAR NAME) - loads the variable from the database.
  • MPM2I2M (MOB/ITEM) - this strange command turns a mob into an item and back into a mob
  • MPHIDE (MOB/ITEM/EXIT) - makes the target undetectable by any means.
  • MPUNHIDE (MOB/ITEM/EXIT) - reverses the affects of MPHIDE -- does not affect Hide or other skills.
  • MPOPEN (ITEM/EXIT) - opens a closed container or door.
  • MPCLOSE (ITEM/EXIT) - closes an open container or door.
  • MPLOCK (ITEM/EXIT) - closes and locks a lockable container or door.
  • MPUNLOCK (ITEM/EXIT) - unlocks a locked container or door, but does not open.
  • MPSETCLANDATA (CLAN) (VAR) (VALUE) - changes a datum about the given clan.
  • MPARGSET ($VAR) (VALUE) - changes internal $(i,n,t,0,1,..9) object to one specified by value.
  • MPLOADQUESTOBJ (QUEST) (QVARNAME) ($VAR) - loads quest obj into internal $(i,n,t,0,1,..9) object.
  • MPUNLOADSCRIPT (SCRIPT FILE NAME) - unloads a file script from the resources cache for refreshing
  • MPQSET (QUEST) (QVARNAME) (VALUE) - set temp quest var to given value.
  • BREAK -- return/break out of the current if condition or program script.
  • RETURN (OPTIONAL STRING) - exits the existing script, returning the string given.
  • (SCRIPT) - embed Javascript in Scriptable event. Must be closed with (/SCRIPT).
  • (COMMAND) (PARMS)- any valid coffee mud command!

-- NOTES! For those commands which have multiple parameters (specifically MPAT, MPFORCE, MPCAST, MPECHOAT, you must use "'" characters in order to group any words in the first parameter of those commands. Inside your command parameters, whether it be text, or even when specifying MOB or ITEM names, you may use any of the following freely:

  • $a - name of the area the monsters in
  • $b - name of last item/mob loaded w/mmpload/mpoload
  • $B - display text of last item/mob loaded w/mmpload/mpoload
  • $c - random npc/pc inhabitants name
  • $C - random npc/pc inhabitants name
  • $i - monsters name
  • $I - monsters display text
  • $n - source of triggers name
  • $N - source of triggers name
  • $t - target of triggers name
  • $T - target of triggers name
  • $r - random pc inhabitants name
  • $R - random pc inhabitants name
  • $j - he/she of the monster
  • $e - he/she of the trigger source
  • $d - title of monsters room location
  • $D - long desc of monsters room location
  • $f - name of the person monster follows
  • $E - he/she of the trigger target
  • $F - he/she of the person monster follows
  • $g - lowercase form of the message from a MPCALLFUNC, MASK_PROG or SPEECH_PROG.
  • $G - uppercase form of the message from a MPCALLFUNC, MASK_PROG or SPEECH_PROG.
  • $J - he/she of a random pc inhabitant
  • $k - his/her of the monster
  • $l - list of all mobs (excluding monster). See "." syntax below.
  • $L - list of all Items in room. See "." syntax below.
  • $m - his/her of the trigger source
  • $M - his/her of the trigger target
  • $K - his/her of a random pc inhabitant
  • $y - sir/madam of the trigger source
  • $Y - sir/madam of the trigger target
  • $o - item1 name
  • $O - item1 name
  • $p - item2 name
  • $P - item2 name
  • $w - owner of item1s name
  • $W - owner of item2s name
  • $x - random valid exit's direction
  • $X - random valid exit's name
  • $xN- north exit's name
  • $0..$9- temporary variables set by other commands.
  • $((CODE) (VAR NAME)) - the variable of the given name, of the given code. Where code is $i, $n, $t, $o, or $p. See MPSETVAR.
  • $((NUM) (QUEST NAME)) - a mob name from the given quest, if the quest is running. The number corresponds to the order in which mobs were designated in the quest script. Counting starts at 1.
  • $((NUM) (QUEST NAME)) - an item name from the given quest, if the quest is running. The number corresponds to the order in which items were designated in the quest script. Counting starts at 1.
  • $%FUNCTION(PARM1 PARM2..)% - replace this code with a value from one of the internal functions. While the names are the same as the eval functions above, their parameters will be slightly different. The functions which may be included in this code include the following:
    • RAND() random number between 1 and 100.
    • HAS((CODE)) name of a random item in given mobs inventory.
    • HASNUM((CODE) (ITEM)) number of the given items in given mobs inventory.
    • WORN((CODE)) name of a random worn item in given mobs inventory.
    • ISNPC((CODE)) not implemented.
    • ISPC((CODE)) not implemented.
    • ISGOOD((CODE)) returns the alignment string of the given mob.
    • ISNAME((CODE)) Returns the real/full name of the given object.
    • CURRENCY((CODE)) Returns the native currency of the given object.
    • MATH((EXPR)) returns evaluated mathematical expressions. +-*\
    • MOOD((MOB NAME)) the given mobs mood.
    • NUMMOBSINAREA((MOB NAME)) number of mobs in area matching mask.
    • NUMMOBS((MOB NAME)) number of mobs in world matching mask.
    • NUMRACEINAREA((MOB NAME)) number of mobs in area matching race.
    • NUMRACES((MOB NAME)) number of mobs in world matching race.
    • ISEVIL((CODE)) alignment number of the given mob.
    • ISNEUTRAL((CODE)) short alignment string of the given mob.
    • ISFIGHT((CODE)) name of the mob the given mob is fighting.
    • ISALIVE((CODE)) health of the given mob.
    • ISIMMORT((CODE)) not implemented.
    • ISBIRTHDAY((CODE)) returns birthday of the mob
    • ISCHARMED((CODE)) name of the charm spell the mob is under.
    • STAT((CODE) (STAT)) value of the given stat for the given object.
    • DATETIME(DAY/TIME/MONTH/YEAR) displays the appropriate numberic value.
    • GSTAT((CODE) (STAT)) like STAT, but player data accessible. See Generic.java.
    • AFFECTED((CODE)) name of a random spell affect on the object.
    • FACTION((CODE) (FACTION)) name of the range the mob has in given faction.
    • ISBEHAVE((CODE)) class ids of the behaviors on the object.
    • ISFOLLOW((CODE)) name of the mob the given mob is following.
    • ISSERVANT((CODE)) name of the mob the given mob is serving.
    • HITPRCNT((CODE))  % of hit points remaining for given mob.
    • INLOCALE() name of the room type the monster is in.
    • INROOM() raw id of the room the monster is in.
    • ISODD((AMT)) echos AMT if AMT is an odd, whole number.
    • ISRECALL((CODE)) start room of the given mob.
    • INAREA() name of the area the monster is in.
    • ISHERE() name of the area the monster is in.
    • VAR((CODE) (VAR NAME)) Value of the given variable.
    • SEX((CODE)) sex of the given mob.
    • POSITION((CODE)) position name of the given mob.
    • LEVEL((CODE)) level of the given mob.
    • QUESTPOINTS((CODE)) questpoints of the given mob.
    • PRACS((CODE)) practices of the given mob.
    • TRAINS((CODE)) trains of the given mob.
    • CLASS((CODE)) class of the given mob.
    • BASECLASS((CODE)) base class of the given mob.
    • RACE((CODE)) race of the given mob.
    • RACECAT((CODE)) racial category of the given mob.
    • GOLDAMT((CODE)) number of gold coins the given mob has.
    • EXP((CODE)) number of experience points the given mob has.
    • VALUE((CODE) (CURRENCY)) base value the given mob has in given currency.
    • QUESTWINNER((CODE)) returns a list of all the quests the mob was won.
    • QUESTSCRIPTED((CODE)) returns a list of all the quests the mob is scripted for.
    • QUESTMOB((QUEST NAME)) returns a list of all the mobs desigated by this quest.
    • QUESTOBJ((QUEST NAME)) returns a list of all the items desigated by this quest.
    • QUESTROOM((QUEST NAME)) returns a list of all rooms desigated by this quest.
    • ISQUESTMOBALIVE((QUEST NAME)) returns a list of all live mobs desigated by this quest.
    • ISTIME() returns the approx time of day in words.
    • ISSEASON() returns the season.
    • ISWEATHER() returns the weather
    • ISMOON() returns the moon phase
    • ISDAY() returns word day or evening.
    • EVAL() not implemented.
    • NUMBER((VALUE/CODE)) Returns the numberic value of the given argument.
    • RANDNUM((VALUE/CODE)) returns random number from 1..value/code.
    • RAND0NUM((VALUE/CODE)) returns random number from 0..value/code-1.
    • ROOMMOB((NUM)) returns the NUMth mob in the room's name.
    • ROOMITEM((NUM)) whether the NUMth item in the room's NAME.
    • NUMMOBSROOM((*/NAME)) returns the number of named mobs in the room.
    • NUMPCSAREA() returns the number of pcs in the area.
    • NUMPCSROOM() returns the number of pcs in the room.
    • EXPLORED((CODE) (AREA/WORLD)) displays % explored of code mob.
    • NUMITEMSROOM() returns the number of items in the room.
    • NUMITEMSMOB((NAME)) returns the number of items the mob has.
    • MOBITEM((MOBNAME) (NUM)) returns the NUMth item owned by mob mobname.
    • INCONTAINER((CODE)) returns container of an item, or the mount of a mob.
    • ISABLE((CODE) (SKILL NAME)) the mobs proficiency in the given skill/ability.
    • ISOPEN((CODE/DIRECTION)) "true" if the container item, or direction name is open.
    • ISLOCKED((CODE/DIRECTION)) the key name if the container, or direction has a lock.
    • STRIN((STRING) (STRING)) word number of the second string if it appears in the first.
    • CALLFUNC((FUNCTION) (PARM)..) the value returned by the FUNCTION_PROG named.
    • DEITY((CODE)) returns a mobs deity.
    • CLAN((CODE)) returns a mobs clan.
    • CLANRANK((CODE)) returns mobs clan role/rank as a number.
    • CLANDATA((CLAN) (VAR)) returns the given clans data based on var.
    • IPADDRESS((CODE)) return ip address of player.
    • QVAR((QUEST) (CODE)) returns temp quest vars.

Any of the $ codes may be followed by a period and a literal number to designate a particular word inside a string of many words. For instance if $o evaluates to "a magic wand", $o.1 would evalulate to "magic". If $l evaluated to "orc bob hassan", $l.2 would give "hassan". This syntax can also be followed by ".." to grab substrings. For instance, if $o evaluates to "a magic wand", $o.1.. would evaluate to "magic wand".

Notes

.

Version

This file was last updated for version 5.9.5.