Change Table Value using self.ID

I have an Actor with an integer variable called "ID" which is to be used to reference a table row.

When I try to change a table cell value I try to set the Row to Self.ID but it does not work.
However when I change this to a number like 1 it does work.

Why is my Self variable not accepted in this situation, it seems like it should.

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Make sure your self.ID attribute has an acceptable value, such as 1. It could be that you're referencing a nonexistent row in the table.
  • CactusheadCactushead Member Posts: 6
    I'm only at the testing stage so I only have two actors one with the ID set at 1 and the other at 2.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Can you post your project? Upload it to Dropbox, for example, and post the download link. I'll take a quick look.
  • CactusheadCactushead Member Posts: 6
    Here is an image of the change table value
    http://oi60.tinypic.com/2s1uf13.jpg
    Like I said my actor's ID is an integer set to 1.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Make sure your self.ID attribute has an acceptable value, such as 1. It could be that you're referencing a nonexistent row in the table.
    Add a log debugging statement with self.ID in the expression editor right before the tableCellValue behavior and then watch the Debugger window to see if it is what you expect it to be.

    In addition to this, make sure you are selecting the attribute from the attribute drop-down list rather than typing it in (which doesn't work).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • CactusheadCactushead Member Posts: 6

    Add a log debugging statement with self.ID in the expression editor right before the tableCellValue behavior and then watch the Debugger window to see if it is what you expect it to be.
    Tried this and I get a 1 or a 2 returned depending on which actor I interact with. This is exactly what I should get.

    In addition to this, make sure you are selecting the attribute from the attribute drop-down list rather than typing it in (which doesn't work).
    Yeah, I selected it from the drop-down list.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Alright, well it sounds like you have it set up correctly. Feel free to send one/both of us your project file and we'll sort it out.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @Cactushead Maybe try putting your value as a tablecellvalue into an attribute first.

    So Change Attribute ValOne to (tableCellValue(game...etc

    Change Table Value
    Table TB_MeltBlocks
    Row: self.ID
    Column: "Counter" Value: ValOne

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • CactusheadCactushead Member Posts: 6
    Thanks for all your assistance but somehow I've got it to now work.

    I changed the Column from "Counter" to just Counter (without quotes) and it all worked.
    Then I changed it back to "Counter" (with quotes) and it still worked.

    This does not make any sense to me but hey, it's working so :D
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    I find that referencing cells by name can be a bit inconsistent so I'm not that surprised to hear that but I'm glad it's working now.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • CactusheadCactushead Member Posts: 6
    edited January 2014
    Yeah, I normally use row and column numbers in other programming software so I'm used to that, but thought that using the names in Gamesalad would make reading the code easier - that'll teach me @-)
Sign In or Register to comment.