How can I place a value in a calculated cell location?

In my game, I'm tracking the number of slots a person has filled with "equipment" actors they've selected.

Table name: table

Columns are:
Column 1: Equipment Slots: The number of slots available for player equipment for this level.
Column 2: Equipment Slots Used: The number of slots currently filled.
Column 3: Equipment Slot 1: Used to hold the first equipment selected
Column 4: Equipment Slot 2: Used to hold the 2nd equipment selected
Column 5: Equipment Slot 3: Used to hold the 3rd equipment selected
Column 6: Equipment Slot 4: Used to hold the 4th equipment selected

The first two columns are integer, and the last 4 are text.
For level 1, Equipment Slots=4, Used=0, and all others cells are empty.

When playing the game, when a player clicks on an equipment actor, I want to put that equipment item in the first open equipment slot.

So, for example, when a player clicks on the "Buy Plant" actor in the scene (Buy Plant is an example of a type of equipment), I check to see if there are slots available using this rule:

Numeric Expression tableCellValue(game.table,1,2) < tableCellValue(game.table ,1,1)
(Note: if equipment slots used < equipment slots)

Next I want to use the ChangeTableValue behavior to put the name of the selected equipment in the first available equipment slot:

Change table value:
Table: game.table
Row: 1
Column: tableCellValue(game.table ,1,2)+1
Value: Plant

What I expect this to do is to take the table cell value for "equipment slots used" tableCellValue(game.table, 1,2) which is 0 at game start, add 1 to it thereby telling Gamesalad to put the value "Plant" in the tableCell(1,3).

After this, I add 1 to the Equipment Slots Used, so the next item selected would be placed in tableCell(1,4), etc.

BUT, it doesn't put anything into the cell. It leaves it blank. I'm assuming that setting the column location to tableCellValue(game.table ,1,2)+1 is somehow wrong, but I'd expect it to pull the value and add 1 to it.

Can anyone explain what I'm doing wrong, or an alternative way to make it happen?

Sign In or Register to comment.