Boolean in tables? What's the use? My workaround, What's yours?

fishZombiefishZombie Member, PRO Posts: 46
edited July 2012 in Working with GS (Mac)
I'm not sure what the use of a Boolean in the table is for right now.
This data can not be accessed in a direct manner.
Example: I want to mark that an item has been bought, so i click the Boolean in Table1 Row1 Column1 to TRUE.
Yes. I can change the value using the "Change Table Value" behavior in the game, when bought.
Now I want to use a rule to find out if that item has been purchased.
i can not say "If Table1,Row1,Column1 is TRUE, then......". I wish I could, but the way the rules are set up, I have to enter a solid attribute FIRST, and then compare it to another attribute value, or equation, etc. But the FIRST box is only an Attribute.
so I can say if Attribute Thingy = Table1,Row1,Column1, then.........
but I can not say if Table1,Row1,Column1= TRUE, then.........
Does anyone know a workaround for this?
Right now, I am Creating 2 gameLevel attributes (2 booleans), 1 set to TRUE, and 1 set to FALSE, and using that.
RULE: If TrueBooleen (which is set to true) = Table1,Row1,Column1, then.......
RULE: If FalseBooleen (which is set to false) = Table1,Row1,Column1, then.......
This is a common problem I found with the basic way that RULE is set up. I wish both sides could have equations.
RULE: If Speed+Weight > 50 then......... Right now, i have to create an attribute XX. change XX = Speed+weight.
Then My rule looks like this: RULE: If XX > 50 then...............

Answers

  • lukey5227lukey5227 Member Posts: 111
    Work around:

    Instead of bool, make it int (integer). 0 or 1. if 0 = table 1 row 1 column 1.

    OR

    if 1 = table 1 row 1 column 1.

    - 5227
  • fishZombiefishZombie Member, PRO Posts: 46
    Yeah, I just figured that. The boolean was not letting me put an comparative value next to it, only true or false. so... Looks like Integer wins out.
    ... brings me back to my first question:
    What is the use of Boolean in Tables?
  • MobileRocketGamesMobileRocketGames Member Posts: 128
    edited July 2012
    I reverse the logic of the procedure to achieve the desired results. So instead of checking if the table equals something, check if something equals the table.

    For example, if you wanted to check if your boolean was true, create a game.Boolean attribute, constrain it to the target you want to check against and create a rule on touch that says if game.Boolean = tableCellValue(table,row,col) then do whatever.

    So although we cannot put a table cell into the attribute slot of a rule, we can constrain an attribute to that specific table, and check if that constrained attribute is whatever. I dont see why you need another workaround, as this works fine.
  • fishZombiefishZombie Member, PRO Posts: 46
    The problem with RULE is (sometimes) it's too "smart" for it's own good.
    If you put a Boolean attribute in the first box in a rule, the second (comparative) box will automatically switch to a true/false selection box, so you can not compare 2 booleans to each other.
    You can, however, get a text result from a table with a boolean. Table,row,col value display.
    I'm going to see if I can have a text attribute, and compare it to the boolean in the table. I know I can display the value using display text, but I'm not sure if that translates over to a text value.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Yes you can compare Text values with a table. Having a booleans Ina table is good for saving preset info. Let's say you have a option heavy game you could have all the Boolean settings for each option in a table now you only need one value to change as many booleans as you want. I recently used this function.
Sign In or Register to comment.