With (MPI)
From Tapestries MUCK
with
{with:var,val,expr..}
This defines a new variable with the given name, and sets it's value to the given val.
Up to 7 expr's are allowed, but the only value returned to {with}'s caller, is the value returned by the evaluation of the last expr. If there is already a variable of the same name, then this command will override that variable, for the duration of the {with:} command.
The new variable is only valid to use within the confines of the {with:} command, and it will go away after the command completes.
This provides scoped variables quite effectively. NOTE: There can be no more than 32 variables defined at any one time, total. This includes variables that are defined within macros, or properties or lists that are executed with {exec:} or {lexec:}.
Here's an example to illustrate the scope of variables inside of {with:} commands:
{prop:_mydesc} <- {&people} not defined. {with:people,{contents:here,players}, <- Defining. Not available yet. {if:{count:{&people}}, <- It's usable now. The players awake here are {lit: } <- just puts in a space. {commas:{&people},{lit: and }, who,{name:{&who}} <- uses {&who} as temp var. } <- {&who} no longer defined. } } <- {&people} no longer defined.