Loop inside loop - Load/Save, Timers, Rules
Hey folks.
I save data via "save attribute". My keys are built from two ids. One for the topic and one for the number of entries. This looks something like:
Timer
Every 0 seconds
- Rule
- Attribute: $k < 20
-
-- Save Attribute
-- $text to $i .. $k
-
- Change Attribute
- $k = $k+1
So all my data will be stored in keys like 50, 52, 53 up to 519 ($i = 5 in this example).
But now i'm having problems loading the data. I simply can't figure out how to set up a loop within a loop.
I thought about using two variables to search through all the rows (topics) and columns (entries).
I tried it with two Every-Timers and two Attribute-Rules: didn't work.
I tried it with an Every-Timer within a For-Timer and two Attribute-Rules: didn't work as well.
Any ideas?
I save data via "save attribute". My keys are built from two ids. One for the topic and one for the number of entries. This looks something like:
Timer
Every 0 seconds
- Rule
- Attribute: $k < 20
-
-- Save Attribute
-- $text to $i .. $k
-
- Change Attribute
- $k = $k+1
So all my data will be stored in keys like 50, 52, 53 up to 519 ($i = 5 in this example).
But now i'm having problems loading the data. I simply can't figure out how to set up a loop within a loop.
I thought about using two variables to search through all the rows (topics) and columns (entries).
I tried it with two Every-Timers and two Attribute-Rules: didn't work.
I tried it with an Every-Timer within a For-Timer and two Attribute-Rules: didn't work as well.
Any ideas?
Best Answer
-
arltmiral Posts: 11
Maybe I don't understand what you are doing but I'm not sure how tables will help in this case, you will still need to loop to scan the table rows and columns.
You're right. I'm just hoping that GS will come up with some database/tables related solutions.
Any ideas how to do a loop-within-a-loop in GS?
Answers
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I would be uber happy if GS will release it this week. Have been working on work arounds last days.
I have 1 actor going to one of 26 random locations based on what level we are playing with a single rule.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
@arltmiral to do a matrix loop you will need to do the following
self.i = 1
self.j = 1
If self.i <= self.MaxRows (for tables there is a function for that)
---Every x seconds
---check value (table or saved attribute...)
---self.j = self.j + 1
---if self.j > self.Maxcolumns (for tables there is a function for that)
------self.j = 1
------self.i = self.i + 1
Haven't tested it, but conceptually it should work