Skip to main content

MPEXAMPLES

Keywords: MPEXAMPLES
Here goes some mobile programs examples: In #MOBILES: M act 1000 pokes you in the ribs. Or in the olc mobile editing: MOBPrograms for [ 1000]: Number Vnum Trigger Phrase ------ ---- ------- ------ [ 0] 1000 ACT pokes you in the ribs. In #MOBPROGS: #1000 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 Ok.. time to translate.. the 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 MOBcommand "mob force". Note that two of these mobiles could easily get into an infinite poke war which slows down (or frequently crashes) the mud just a bit :( Be very careful about things like that if you can. (i.e dont respond to a poke with a poke, and try not to let heavily programmed robot mobiles wander around together. More on that is given above.) Also, it is clear that the 'order' command could get confused with the 'or' control flow. However, this is only the case when 'order' is abbreviated to its two letter form, and placed immediately following an 'if' line. Thus, if you want to be that malicious in trying to break the MOBprogram code, noone is going to stand in your way (However, the result of this would be a bug message and a bail out from the ifcheck so things dont really break) More Examples: help mpexamples1