Mklist (MPI)
From Tapestries MUCK
(Difference between revisions)
(added another example and some usage info.) |
|||
(One intermediate revision not shown) | |||
Line 1: | Line 1: | ||
- | [[Category: | + | [[Category:functions (MPI)]][[Category:List Handling Functions (MPI)]] |
=mklist= | =mklist= | ||
+ | |||
<mpi>{mklist:value...} Returns a list with all given values.</mpi> | <mpi>{mklist:value...} Returns a list with all given values.</mpi> | ||
This returns a list with all the given values as list items, seperated | This returns a list with all the given values as list items, seperated | ||
Line 11: | Line 12: | ||
Example: | Example: | ||
<mpi>{mklist:{mklist:a,b,c,d,e,f,g,h,i},j,k,l,m,n,o,p}</mpi> | <mpi>{mklist:{mklist:a,b,c,d,e,f,g,h,i},j,k,l,m,n,o,p}</mpi> | ||
+ | |||
+ | It's common among [[MPI]] commands to require things to be arranged in a [[list]] format, but a lot of the time you are creating that list on the fly from a bunch of assorted data (i.e. {contents:here}). You can use the {mklist:} command to make a fake list. | ||
+ | <mpi>{parse:i, «- Start a parse | ||
+ | {mklist:{contents:here,player}} «- Use mklist to make a list from the players in the room | ||
+ | ,{name:{&i}} is a {sex:{&i}} {species:{&i}} «- Spit out everyone's information | ||
+ | } «- End the parse | ||
+ | </mpi> |
Latest revision as of 04:23, 25 April 2007
mklist
{mklist:value...} Returns a list with all given values.
This returns a list with all the given values as list items, seperated by carriage returns. ('\r's) Example:
{mklist:Tom,Dick,Harry}
returns "Tom\rDick\rHarry".
Note: A maximum of nine items can be passed to the {mklist} function. If you need more, you can chain {mklist}s together.
Example:
{mklist:{mklist:a,b,c,d,e,f,g,h,i},j,k,l,m,n,o,p}
It's common among MPI commands to require things to be arranged in a list format, but a lot of the time you are creating that list on the fly from a bunch of assorted data (i.e. {contents:here}). You can use the {mklist:} command to make a fake list.
{parse:i, «- Start a parse {mklist:{contents:here,player}} «- Use mklist to make a list from the players in the room ,{name:{&i}} is a {sex:{&i}} {species:{&i}} «- Spit out everyone's information } «- End the parse