Multiple Arguments in MPI
A guide by Draikan Zeil
The other day I was paged with some one asking me how to get multiple arguments for a MPI program they wanted.
You see, they needed to get 3 arguments in one line of text: Give -player- -amount- -moneytype-
I thought about it for a bit and then it hit me: make it a list!
I'm suprised that I didn't think of it before, but I did now so thats what counts, rite?
There was a small error on my part but it was fixed so all's good now and it works.
So, I'll go through this with you the same way I went through it with them.
First, you need an argument: {&arg}
Okay, but what about making it more arguments? Ah, well we need to make it into a list then! We can use {Subst:x,y,z} for this if we change all spaces into new lines like so:
{subst:{&arg}, ,\r}
(Incase you don't know, \r does the same thing as {nl}.)
Well thats all good and well, but how do we select each line to fit our needs? Easily! We can use the function {sublist:x,y} to select the needed line of the argument.
So we wrap that around the previous statment:
{sublist:{subst:{&arg}, ,\r},XYZ}
--->Replace XYZ with the line number needed.
This allows you to use as many arguments as the user puts in, and opens worlds of possibilities for what you can do with one command (you can actually use one command for everything without using multiple names... meaning that any player can add commands onto somthing in a "mpi playground" of sorts).
For example, lets you want to have a two-argument line:
give -player- -amount-
You could set it up so the first line is setup to store amount under the player's money prop.
This holds many uses of course, such as games, security, chat, playgrounds, banking systems, item systems, single line with many commands to store something... etc...
Well, hope that helps.
Untill next time,
-Drakain Zeil
Thanks to Marie on RW MU* for asking me about it.