|
zeroz Newbie
Joined: 27 Jul 2002 Posts: 8 Location: USA
|
Posted: Tue Jul 30, 2002 6:59 pm
Another question! |
Well, I just did some searching around and couldn't find my answer. :)
Here's what I've got...
I have a class that is activated, and checks to see how much of something is in a warehouse on the game I play.
Now, I know how I can get the data from the triggers... but it's a question of storing it. :)
Can arrays store list variables?
See, we have this data here:
quote:
1. 120 tons of Commodity (cost 570 IG/ton) from Myplanet
2. 120 tons of Univators (cost 570 IG/ton) from Myplanet
(and so on...)
Then we have at the bottom:
quote:
There are 19 bays left free.
Now, I'm looking to store the data like this:
quote:
@WareHouseList
|-------@Bay
| |--@Tonnage
| |--@Commodity
| |--@From-Planet
|
|-------@Bay
|--@Tonnage
|--@Commodity
|--@From-Planet
In most programming languages, I could use a nested array to do it easily. I read that zMUD doesn't support this. I'm also trying to keep my script fairly compatible with pre 6.3x versions of zMUD. At any rate... I figure make a WareHouseList array, have the bay# point to a @Bay list variable.
#TRIGGER {^(%d). (%d) tons of (%x) (cost %d IG/ton) from (%w)$}
{Bay.Tonnage=%2} {Bay.Commodity=%lower(%3)} {Bay.FromPlanet=%lower(%4)}
{#if (!@WarehouseArray) {#VAR WarehouseArray %array(%1,@Bay)} {#NOOP %arrset(%1, @Bay)}}
Will the above code accomplish what I want? Or will I be forced to generate a new variable for each instance of @Bay?
Thanks in advance. :)
- Z |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Jul 30, 2002 10:19 pm |
Since zMud does not have a Struct or Record type, the cloest thing would be a db variable. In fact they are called database record for a reason. You can build a single record in a single variable (using ADDKEY command), then you can use the nesting capabilities Zugg added since version 6.21 to put those into your warhouse variable. Regrettably that would not work with 6.16 and early. Prior to the function of nesting it was common practice to replace the list seperator (| symbol) with another character then store it. You could use the same practice.
|
|
|
|
Apollyon Wanderer
Joined: 02 Oct 2001 Posts: 76 Location: USA
|
Posted: Wed Jul 31, 2002 10:09 pm |
i doubt your trigger will work, you must remember when you are working with () that you have to use
~(cost %d IG/ton~)
not using the ~ will make your life very frustrating, and you will get all pissed off that you think that everythign is all hunky dorey when in fact you are missing something as simple as that
you have to use it on [] as well, there are probably more but i cannot think of them rightnow |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Aug 01, 2002 6:01 pm |
You might be able to do this by combining the use of stringlists and db-record variables.
#TR {^(%d). (%d) tons of (%x) ~(cost %d IG/ton~) from (%w)} {#ADDKEY Warehouse %1 {Bay %1|%2 tons|{%3}|%4}}
You may need to adjust the spaces in the trigger phrase.
You can then access the data using the database and list functions. Example:
#SHOW {The contents of bay 1 is %item({%db(@Warehouse,1)},3). It comes from planet %item({%db(@Warehouse,1)},4).}
LightBulb
Senior Member |
|
|
|
Nomad Newbie
Joined: 11 Aug 2002 Posts: 6
|
Posted: Sun Aug 11, 2002 7:01 pm |
Hay Zeroz
I just finnaly logged in here and find you.
i just finished the trigger this morning that will help you.
ether tb me in the game or email me.
i am not at home so i can not post you the script here..
NoMaD |
|
|
|
|
|