Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
qazea
Newbie


Joined: 23 Jun 2001
Posts: 7
Location: USA

PostPosted: 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.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: 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
Reply with quote
qazea
Newbie


Joined: 23 Jun 2001
Posts: 7
Location: USA

PostPosted: 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?
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Wed Mar 24, 2004 6:52 pm   
 
Oh yes, I forgot about that one. Change (%w) to (*), in the trigger.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net