|
sepe Novice
Joined: 09 Feb 2002 Posts: 39 Location: USA
|
Posted: Sat May 18, 2002 12:36 am
increasing variable name |
WHat I'd like to know, can you use say the ADD command to change a variable name.
Example - Listvar1
A process I do on my mud provides me a long list. I'd like each item on that list to be assigned to a variable. I can do the REEEEEAAAAALLLLY long process of making about two hundred preset variables, but that would bog me down hard. Instead I was thinking of such
pattern = "(%W)" *
command = #va listvar1 %1
the next time this trigger fires I'd like it to read as such
command = #va listvar2 %1
Notice listvar1 increased to listvar2
can I use the ADD command? or can I make a base variable name (in this case listvar) and combine it with a second var (the number) and create the third Variable?
A bit winded and unsorted, but I hope you understand, thanks
Dazed glazed and having fun |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat May 18, 2002 1:06 am |
quote:
WHat I'd like to know, can you use say the ADD command to change a variable name.
Example - Listvar1
A process I do on my mud provides me a long list. I'd like each item on that list to be assigned to a variable. I can do the REEEEEAAAAALLLLY long process of making about two hundred preset variables, but that would bog me down hard. Instead I was thinking of such
pattern = "(%W)" *
command = #va listvar1 %1
the next time this trigger fires I'd like it to read as such
command = #va listvar2 %1
Notice listvar1 increased to listvar2
can I use the ADD command? or can I make a base variable name (in this case listvar) and combine it with a second var (the number) and create the third Variable?
A bit winded and unsorted, but I hope you understand, thanks
Dazed glazed and having fun
Try this out:
#alias MakeList {#if (%null(%-1)) {#NOOP we have an argument passed to the alias;#ADD Count 1;#VARIABLE ListVar@Count {@ListVar%eval(@Count - 1)}} {#NOOP no arguments passed to the alias}}
If the #VARIABLE syntax doesn't work here, use the Variablename = value syntax.
li'l shmoe of Dragon's Gate MUD |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat May 18, 2002 1:06 am |
Yes, this is possible. Here is an example of how to do it:
#VAR count 0
#TRIGGER {"(%w)" *} {#ADD count 1;#VAR listvar@count %1}
Kjata |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|