Macros (MPI)
From Tapestries MUCK
(Difference between revisions)
m (MPI macros moved to Macros (MPI)) |
|||
Line 1: | Line 1: | ||
- | [[Category:MPI functions]] | + | [[Category:MPI functions]][[Category:MPI Macros and Functions]] |
=macros= | =macros= | ||
If the MPI interpreter comes across a function name that it does not recognize, it will look in the _msgmacs/ propdirs down the environment from the trigger object, for a property with the name of the function. | If the MPI interpreter comes across a function name that it does not recognize, it will look in the _msgmacs/ propdirs down the environment from the trigger object, for a property with the name of the function. |
Revision as of 00:51, 31 March 2007
macros
If the MPI interpreter comes across a function name that it does not recognize, it will look in the _msgmacs/ propdirs down the environment from the trigger object, for a property with the name of the function.
If it does find it there, then it takes the value of that property, and substitutes it in for the function as a macro. The arguments to the function replace the {:1} through {:9} markers in the macro definition.
For example, if there were a property set on #0, defined as:
_msgmacs/div_rand:{add:{div:{:2},10},{dice:{:1}}}
And you had some MPI code that looked like:
{div_rand:22,160}
Then the macro would expand out to:
{add:{div:160,10},{dice:22}}
After the macro argment substitution is complete, it is then evaluated.