Checking & Storing a lower value in a table?
danteshope
Member, PRO Posts: 2
Hi GS members,
I'm stuck in a bind at the moment, maybe someone with a better mind can help me?
What I am trying to do is, store a value (from a running timer) from beginning of the game. When the game ends it will store the timer value (lower value) in a table I have named TableA in Row 1 Col 1.
I am not sure about the checking of new timer value to the tabled values, and if it is lower, replace the the value in the table.
Anyone have any ideas?
Comments
I deleted your duplicate thread.
Create a real attribute (or integer if you prefer) called game.timeLeft and set its value to some number of seconds such as 30.
Have a Timer set to every 0.1 seconds that changes attribute game.timeLeft to game.timeLeft-0.1.
When the game ends, have a rule that checks to see if attribute game.timeLeft < tableCellValue(tableName,1,1). If so, Change Table Value [tableName] row: 1 col: 1 value: game.timeLeft.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Hey @danteshope,
I think I am understanding you correctly and if not I apologize. What I am getting from your post is if timer value is less than the stored table value then change it. If that is what you are trying to accomplish then I would have something along these lines.
When game.GameEnds is true
~(New Rule Inside Top Rule)~
When timer value is < tablecellvalue(TableA,1,1)
change table value
Table: TableA
Row: 1
Column: 1
Value: timer value
Save Table
Hope that helps if that's what your looking for!