Shamelessly swiped from Stephen A. White's home page! -- Telzey
Practical MPI Examples
Usage: {look-notify:MPI version of the @6800 desc-notify feature, using all the same message properties, such as _desc_notify_looker, _desc_notify_looked, _desc_objector, and _desc_objected. If a person has a %n property set, then that will be displayed for %n in messages (use {name:me} instead for displaying a person's full name). Look-notify will also evaluate any lists passed to it for embedded MPI commands.}
{look-notify:{list:mydesc}}This displays the list 'mydesc' to the person looking, and notified you that they looked.
Return to the Getting Started Page or the Example Index.
@desc me= (Concat to all one line)This shows a description composed of several parts:
{pronouns:{prop:_morphs/{prop:morph}},this}{nl}
{pronouns:{prop:_wardrobe/{prop:clothes}},this}{nl}
{prop:ribbon} {prop:extra}
{if:{smatch:{prop:buttons},y*},{nl}{rand:buttons}}
{null:{tell:{name:me} is looking at you.,this}}
Return to the Getting Started Page or the Example Index.
@link west=This only permits a player to use the 'west' exit if there are less then 10 people in the room to the west.@lock west=_MyMPIScript:1
@set west=_MyMPIScript:{lt:{count:{contents:{links:this},Player}},10}
Return to the Getting Started Page or the Example Index.
@action zom=me
@lock zom=me&!me
@set zom=h
@fail zom={null:{force:#9999,{&arg}}}
Return to the Getting Started Page or the Example Index.
@set me=_connect/always-dressed:&{null:{store:no,nude?,me}}Making sure you don't wander around sexually aroused (assuming your @desc is set so that you appear aroused whenever you do '@set me=aroused?:yes'): This will reset when you leave the current room for any reason.
@set me=_depart/back-to-normal:&{null:{store:no,aroused?,me}}
Return to the Getting Started Page or the Example Index.
@set here=_arrive/distractions:&{if:{eq:1,{dice:4}},{null:{delay:{dice:6,10}, {lit:{null:{otell:here,{rand:distractions},#-1}}}}}}A quarter of the time (i.e. {if:{eq:1,{dice:4}},XXX}) when someone enters the room, display a message from the list 'distractions' after a 6-10 second delay, to everyone. (otell: all but #-1, which means everybody).
Return to the Getting Started Page or the Example Index.
@lock north=female:yesNotice that instead of lots of {or}'s and {eq}'s, you can check whether a value equals one of a list of values using {lcommon}.
@set north=female:{if:{lcommon:{prop:sex,me},female{nl}mare{nl}bitch{nl} vixen{nl}doe{nl}vampyress{nl}skunkette{nl}lioness{nl}tigress},yes,no}
Return to the Getting Started Page or the Example Index.
This is the ugly, all in one line version, that you would enter in reality:
@succ here={with:estart,{prop:_exitlist_start,this},{if:{&estart},this is the program expanded out and explained:
{&estart},[ Obvious exits: }}{subst:{lsort:{parse:temp2,{filter:
temp,{exits:here},{with:isvis,{tolower:{midstr:{prop:_visible?,
{&temp}},1}},{or:{eq:{&isvis},y},{and:{istype:{links:{&temp}}
{prop:_exit_name,{&temp2}},{name:{&temp2}}}}},\r, }{with:
eend,{prop:_exitlist_end,this},{if:{&eend},{&eend}, ]}}
@succ here=The succ of a room will be displayed after the descriptions is
{with:estart,{prop:_exitlist_start,this}, {if:{&estart},{&estart},[ Obvious exits: } }This displays '[ Obvious exits: ' unless _existlist_start is defined. If it is, is is displayed instead.
{subst: {lsort: {parse:temp2,Parse takes a list and applies an operation to it, converting it into a new item. In this case, taking all exists that should be shown, and returning a list of the names that should be displayed. This list is sorted and the subst concatenates the list into one line of entries to be displayed. (See further on)
{filter:temp,{exits:here}, {with:isvis, {tolower:{midstr:{prop:_visible?,{&temp}},1}}, {or:{eq:{&isvis},y}, {and:{istype:{links:{&temp}},Room}, {ne:{&isvis},n} } } } },This generates a list of exits, {exits:here} and filters them, only including the ones that have the prop _visible? set to 'y', or else exits that point to rooms and that don't have _visible? set to 'n'. The result is handed to parse which executes the next section on each entry:
{if:{prop:_exit_name,{&temp2}}, {prop:_exit_name,{&temp2}}, {name:{&temp2}} }For every exit returned by the above (by dbref), it return its name, unless the prop _exit_name is defined. If so, it returns that as a name instead.
} } ,\r, }This is the end of the parse, lsort and subst, respectively
The list that is generated by parse is sorted (by lsort) and then the subst converts all the '\r' to ' '(2 spaces). This results in the lists of exits being converted from a list of entries, one per line, to a concatenated list, all in one line.
{with:eend,{prop:_exitlist_end,this},{if:{&eend},{&eend}, ]}}This displays ' ]' unless _existlist_end is defined. If it is, is is displayed instead.
The result of all this is that we have displayed for example:
[ Obvious Exits: East North South West ]
Feedback: Please send your message to The Webmaster.webmaster@furrymuck.com
Date: Feb. 20, 2012