Check if a table cell (boolean) is true or false before calling it


I am on the final strip for publishing my first game. Just one more thing I need to know to get done:

I want to set an attribute (integer) = row number of a table. No problem till here. The row that should be called is not defined but has a column with a boolean. Only one of the rows has this boolean set to true, all others are false. What I want is to check for the row that has the boolean column set to true before defining the integer attribute to that row.

Example: There are 5 Rows and 2 Columns. Column 1 has the description in it, column 2 is set to boolean. The boolean in row 2 is set to true, rows 1, 3, 4 and 5 are set to false. The attribute therefore should be set to 2.

Any workarounds or ideas?

Best Answer


  • ArmellineArmelline Member, PRO Posts: 4,971
    edited September 2016

    Will only 1 ever be set to true? If so, you can just use tableSearch, looking for the key "1". (Not sure if "true" works too, I've always just used "1".)

  • hansdrumhansdrum Member, PRO Posts: 22

    Yes, only one will be set to true at a time. Whenever another one will be set to true the table will be resetted before, so its always one at a time, but not always the same.

    How can I use the search function?

    tableSearch(table, "[row|col]", targetRowCol, startRange, endRange, "(not)[exact|beginsWith|endsWith|contains]")

    And what behaviour will do it? Change attribute to table search function?

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

    You can Google table search gamesalad to find tutorials.

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

  • hansdrumhansdrum Member, PRO Posts: 22

    @-Timo- said:
    Something like this? It's still best if you search for tutorials so you understand what it does and how you can do it on your own.

    Well, this helped! Not exactly what I need but now I can play around with the commands. Thanks!

Sign In or Register to comment.