Table Cell Value
Summation
Member, PRO Posts: 476
How do I change a table cell value to itself plus one?
I've tried using the Change Table Value behavior using both of these configurations (not at the same time) and they aren't working for me:
Change Table Value
Table: game.table1
Row: 1
Column: 1
Value: +1
Change Table Value
Table: game.table1
Row: 1
Column: 1
Value: tableCellValue(game.table1, 1, 1)+1
Best Answers
-
RThurman Posts: 2,880
The second way should work. Did you define column 1 of the table as type integer?
-
Braydon_SFX Posts: 9,273
Yep, like anyway mentioned, the second example should work. Make sure you're changing the correct cell.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Answers
I was working on this last night and it wouldn't change in the previewer. Turned off my computer. Turned on my computer again and opened up my file (just now) and it's working all of a sudden. Not that I'm complaining!
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
I am having problems with this to!
I have spawned in a grid of actors.
I want to use touch on one of the actors and chnage it’s cell value.
I can use touch on any one of the actors and change image but this will not work with a pathfinder I need to change the cell value.
@lonzzy007 Then you will need to sync up each actor with a specific cell (row and column). The best way to do that is as follows:
In the spawned actor, create integer attributes called self.row and self.column. Also create integer attributes called game.row and game.column. In the spawner actor, right before the spawn behavior, change game.row and game.column to match wherever you are in the grid at that moment. In the spawned actor, at the top of the rules, change attribute self.row to game.row and self.column to game.column. This will store those temporary values from the spawner actor within each spawned instance. Then, you can use self.row and self.column in any table behaviors (e.g. Change Table Value) as needed to update the cell that is associated with that actor.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User