|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Tue Aug 21, 2001 3:23 pm
Database variable, sorting |
There is a database variable, storing information concerning what elixir/salve type is in each vial. There are trigger to set this up, which work fine. The resultant variable looks something like what you would get if you entered this:
#ADDKEY elixlist{12325=health|34552=empty|34562=mending|3554=empty}
When this command is used:
#SHOWDB @elixlist
The following output is gotten:
12325: health
34552: empty
34562: mending
3554: empty
This is kinda nice. But I want it sorted so that all of the empties come one after the other, and all of the healths in a group, etc etc. I couldn't figure it from the help files
Caled
zMud 6.16 |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Tue Aug 21, 2001 3:30 pm |
I should add that I dont wish to do it by having a #LOOPDB for each elixir-type. The reason is that there are around 35ish possible contents for the vials, and I'd rather not have to write 35 separate thingies if there is a #VIEW or #QUERY way of doing it in a single step....
Caled
zMud 6.16 |
|
|
|
Muorshai Newbie
Joined: 20 Jan 2002 Posts: 3
|
Posted: Sun Jan 20, 2002 7:29 pm |
This may be a bit of a late reply, but I'll post it anyway. I may suggest that instead of a database, create a stringlist for each vial type (eg. health, mana, etc) and a stringlist for each type of vial. That way you can cycle through each vial type and the identifiers. (sorry I haven't got the code to post....I'll try to get back to it when I have my files available.
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Jan 20, 2002 11:21 pm |
Try using this alias to sort the items in the variable:
#ALIAS sortByValue {#VAR temp "";#LOOPDB @%1 {#ADDITEM temp %concat(%val, "=", %key)};#VAR temp %sort(@temp);#VAR %1 "";#FORALL @temp {#ADDKEY %1 %word(@temp, 2, "=") %word(@temp, 1, "=")};#UNVAR temp;#GAG}
Kjata |
|
|
|
|
|