MPSYNTAX
Keywords:
MPSYNTAX
The syntax of any mobile program can be as shown below:
if <if_check_1> <argument> <operator> <value>
or <if_check_2> <argument> <operator> <value>
or <if_check_N> <argument> <operator> <value>
and <if_check_N> <argument> <operator> <value>
and <if_check_N> <argument> <operator> <value>
<program_command_1>
<program_command_2>
break
<program_command_N>
else
<program_command_1>
<program_command_2>
break
<program_command_N>
endif
Basically it is an 'if' line, followed by 'and' and/or 'or' lines,
followed by some mud commands, which may contain a 'break' line, possibly followed by an 'else' line, followed by more mud commands, which may contain a 'break'line, followed by an 'endif' line.
The 'if' line is any valid if_check expression, those if_check
expression can be conbinated with the logic operators or and and. The BREAK command bails out of the entire mobile program regardless of the level if nesting. (END is a synonym for BREAK).
Examples:
MOBPrograms for [ 5003]:
Number Vnum Trigger Phrase
------ ---- ------- ------
[ 0] 5009 ACT pokes you in the ribs.
#5009
if isnpc $n
chuckle
poke $n
break
else
if level $n <= 5
or isgood $n
tell $n I would rather you didnt poke me.
else
if level $n > 15
scream
say Ya know $n. I hate being poked!!!
if mobhere guard
mob force guard kill $n
endif
kill $n
break
endif
slap $n
shout MOMMY!!! $N is poking me.
endif
endif
This trigger will only happen when the mobile gets the message "... pokes you in the ..." If the offender (recall the $n and $N refer to the char who did the poking...) is an NPC, then the mobile merely chuckles and pokes back. If the offender was a PC then good and low level characters get a warning, high level chars get attacked, and midlevel chars get slapped and whined at. Also, when attacking, the mobile will check if there are guards in the room (if mobhere guard) and if one is found, it will be forced to attack the player, too (mob force guard mob kill $n). Notice the use of a mobile command "mob force".
See Also
Mobhelp
Ifhelp
If Checks
Variables
Mob Asound
Mob Echo
Mob Oload
Mob Kill
Mob Flee
Mob Remove
Mob Junk
Mob Purge
Mob At
Mob Goto
Mob Transfer
Mob Force
Mob Cast
Mob Damage
Mob Delay
Mob Cancel
Mob Remember
Mob Forget
Mob Call
Mob Tgive
Mobprogram List
Mobile Programs
Triggers
Operators
Mpsyntax
Mp Building
Mpexamples
Mprog Character Variables
Mpcommands
Checkmoblog
Medit
Vnum
Trigger Hpcnt
Wimpy
Spells
Obj Type Token