|
qazea Newbie
Joined: 23 Jun 2001 Posts: 7 Location: USA
|
Posted: Wed Mar 24, 2004 6:09 pm
Multiple items in a var? And triggering off it. |
Is it possible to store more than one value in a variable?
I want to store a list of enemies in a variable called @enemies and then when one of them enters the room it automatically updates my @target variable to what entered.
The enemies would be Centaur, Grey Elf, Half-Elf. There would be 3 enter syntax though:
A Grey Elf enters from the west.
A Half-Elf flies in from the west.
A Centaur trots in from the west.
If anyone reading this knows of a way to do this please let me know.
Thanks. |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Wed Mar 24, 2004 6:26 pm |
Yes, such a variable is called a list. There are multiple commands/functions for dealing with lists. The one you'll require for this is: %additem
#trigger {A (%w) {flies in|enters|trots in} from the (%w)} {#var Target {%additem(%1,@Target)}}
Other useful functions/commands: %ismember, %item, #delnitem, #forall, #additem |
|
|
|
qazea Newbie
Joined: 23 Jun 2001 Posts: 7 Location: USA
|
Posted: Wed Mar 24, 2004 6:48 pm |
Thank you for the reply, this works great except on the Grey Elf where it won't match probably because of the space between the name?
How would you modify this to work with Grey Elf? |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Wed Mar 24, 2004 6:52 pm |
Oh yes, I forgot about that one. Change (%w) to (*), in the trigger.
|
|
|
|
|
|