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
brys0005
Newbie


Joined: 22 Sep 2005
Posts: 9

PostPosted: Fri Jul 21, 2006 7:50 am   

Please help with a key/record list
 
So i need to store stuff into a key/record list. I've figured this part out:
#ADDKEY list {key} {record}

Now, I need to match something to the list. say my record list looks like:
bat|kick|dog|punch
and i have bat stored in the variable mob.

why dosn't this work:

%iskey(@mob, @list) - shouldn't this return true because bat is a key in the list?

I need to be able to match a variable against the list and if the variable is a key, then i need to pull the record out. so in this case I would match @mob and get the command 'kick'

Question
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jul 21, 2006 12:47 pm   
 
Could also work it like:

#ADDKEY List MobIndex
#ADDITEM List.MobIndex Dog
#ADDKEY List Dog 1

#IF (%ismember(%1,@List.MobIndex)) {#SH List.%1
Reply with quote
brys0005
Newbie


Joined: 22 Sep 2005
Posts: 9

PostPosted: Fri Jul 21, 2006 6:28 pm   
 
I thought %ismember is for lists, not records
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jul 21, 2006 10:18 pm   
 
Yes %ismember is for lists and not records. However Ton's code has already referenced into the record through the dot notation...minor correction of missing close brace:

#IF (%ismember(%1,@List.MobIndex)) {#SH List.%1}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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