GameSalad

Table Cell Value

SummationSummation Posts: 476Member, PRO

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

Answers

  • SummationSummation Posts: 476Member, PRO
    edited April 2015

    @Braydon_SFX said:
    Yep, like anyway mentioned, the second example should work. Make sure you're changing the correct cell.

    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!

  • lonzzy007lonzzy007 Posts: 7Member

    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.

  • tatiangtatiang Posts: 11,266Member, Sous Chef, PRO, Senior Sous-Chef

    @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

Sign In or Register to comment.