GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Checking a Table Value before Changing It

dominic.koponendominic.koponen Posts: 22Member
edited May 2012 in Tech Support
Hello All,

So I have an actor that is a button which controls whether the music is on/off. My question is: Can I "check" what a TABLE value is before I decide to change it? I know you can check for an attribute in the attributes list, but can you check for it if its INSIDE a table?

For example: I want it to have a rule that says if the touch is pressed AND x-attribute is true (Music is on), then change table value to false (turn music off). And vice-versa, if the touch is pressed and x-attribute is false (Music is off), then change table value to true (Turn the music back on). I understand you can check what you want if the attribute is in the attributes list, but it doesn't seem that you can check any attributes that reside in the table.

When I try and create a rule to do this now, I seem to be getting the ability to only check the table name? Which does not seem to have any functionality for me. Any help will be greatly appreciated!

Thanks!

Best Answers

  • uptimistikuptimistik VenezuelaPosts: 3,598Member, Sous Chef, PRO
    edited May 2012 Accepted Answer
    Yeah you need a bit of a work around for this. You would need to have an attribute on the actor e.g. a Boolean named Music
    And then say
    if attribute self.Music = Cell.Table.Value (wherever your cell is) then do whatever action u had planned.


    EDIT: Damn...beaten by the forum's tshirt wearing dude....

    New Templates Daily At The Official GameSalad Marketplace GSHelper.com

  • uptimistikuptimistik VenezuelaPosts: 3,598Member, Sous Chef, PRO
    Accepted Answer
    No you'd be able to access this anywhere. Use the video method instead. Super easy, super effective.

    New Templates Daily At The Official GameSalad Marketplace GSHelper.com

Answers

  • dominic.koponendominic.koponen Posts: 22Member
    make an attribute and enter its valse as what you want to check for say its 1

    attribute game.check set to 1

    rule if game.check is = to table cell value(table,row,col)

    but there is as much better way for on off button


    cheers

    Thank you guys both! You guys rock! Tshirtbooth, is the video tutorial the "better" way I should use? I want this music on/off option to be changeable from different places in the app. Therefore, I was hoping to use a table, which is more organized than just having a huge list of attributes.
  • dominic.koponendominic.koponen Posts: 22Member
    Ah I see! I feel like an idiot... haha I did not know there was a game.audio.musicvolume attribute built in. I was making this way too complicated. I was trying to avoid using the attributes section for organizational purposes but this makes things a lot easier. Thanks guys, the help is much appreciated!!!
This discussion has been closed.