I'm looking for some help in wrapping my head around how to properly create this series of nested tables, and how to update them. Here's my situation:
I have 10 stores. When I can do check <storename> I can see their contents - which includes item, buy price, stock, and sell price.
The items in all 10 stores are the same, so I simply want to check each one, and be able to manipulate the data for comparison (i.e. find the store with the lowest priced object, ect.)
So I was thinking one table called stores, nested inside is store1 store2, ect., and nested inside is itemname, buyprice, stock, sellprice.
My problem lies in the actual coding, I guess. I need it to select the table by one trigger, but capture the data to put in it by another. Like so:
This would do something like SetVariable("cur_village", "%1") where %1 is acknor.
Then lines after that are like this:
So, I want that data to go into stores[acknor][wood][8, 130, 73]
Note: I don't need help with the regex, that's easy. Just failing in the actual scripting part.
I get errors when I try to set the table by variable. Like cur_village{}. It says it's a string, which, fair enough, I'll agree. So I'm not sure how to turn cur_village{} into acknor{} or whatever cur_village is currently.
Guess I've got pieces of the solution in my head, but I'm having trouble solving everything/putting it all together. Any suggestions/ideas are appreciated.
I have 10 stores. When I can do check <storename> I can see their contents - which includes item, buy price, stock, and sell price.
The items in all 10 stores are the same, so I simply want to check each one, and be able to manipulate the data for comparison (i.e. find the store with the lowest priced object, ect.)
So I was thinking one table called stores, nested inside is store1 store2, ect., and nested inside is itemname, buyprice, stock, sellprice.
My problem lies in the actual coding, I guess. I need it to select the table by one trigger, but capture the data to put in it by another. Like so:
*******************The Ledger for the Village of Acknor********************This would do something like SetVariable("cur_village", "%1") where %1 is acknor.
Then lines after that are like this:
Wood 8 gp 130 73 gpSo, I want that data to go into stores[acknor][wood][8, 130, 73]
Note: I don't need help with the regex, that's easy. Just failing in the actual scripting part.
I get errors when I try to set the table by variable. Like cur_village{}. It says it's a string, which, fair enough, I'll agree. So I'm not sure how to turn cur_village{} into acknor{} or whatever cur_village is currently.
Guess I've got pieces of the solution in my head, but I'm having trouble solving everything/putting it all together. Any suggestions/ideas are appreciated.