Password Recovery

Parse (MPI)

From Tapestries MUCK

Revision as of 01:32, 25 April 2007 by Kles (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



This evaluates expr for each and every item in the given list.

On each evaluation, the temporary variable var will contain the value of the item under scrutiny. This function returns a list containing the output of expr for each item within the list. This lets you do direct translation of a list of dbrefs, for example: into a list of names. var will only be defined for the duration of expr, and will be undefined after the {filter} construct finishes.

If sep is given, then it uses that string as the item seperator in the input list, instead of the usual carriage return character. If s2 is defined, then it will use that string to seperate the items in the list it returns, instead of the normal carriage return.

sep and s2 can be multiple characters long.

A simple example of using parse is below, it would print out a statement to show the name, sex, and species of everyone & everything in the room.

{parse:i,                  «- Here we set the variable to {&i} for the parse.
{mklist:{contents:here}},       «- Here we take the contents of the room and make it a list
{name:{&i}} is a {sex:{&i}} {species:{&i}} «- Here we spit out Each thing's information.
}                               «- Here we end the parse

An if (MPI) statement with eq (MPI) and istype (MPI) could be used to filter the list to players only.

{eq:{istype:{&i},player},1},    «- Here we set the if to check if {&i} is a player or not
{name:{&i}} is a {sex:{&i}} {species:{&i}} «- Here we do the 'true' part of if
,}                              «- Here we do the false part of if and set it to do nothing
Personal tools