|
brys0005 Newbie
Joined: 22 Sep 2005 Posts: 9
|
Posted: 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'
|
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: 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 |
|
|
|
brys0005 Newbie
Joined: 22 Sep 2005 Posts: 9
|
Posted: Fri Jul 21, 2006 6:28 pm |
I thought %ismember is for lists, not records
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
|
|