GameSalad

Why "numeric expression" will let all boolean be true?

WeiyuWeiyu Posts: 136Member, PRO
edited March 9 in Working with GS (Mac)

Hello everyone!
I have a question about "numeric expression".

I make a "Table"(3 booleans ), three "lockers" at "Scene_A" and one "Clear Button" at "Scene_B"

I don't know why all booleans will become true when I touch the "Clear Button".
Under only one button circumstances, I just want to let "Locker_2" will be "true" and "Locker_3" keeps "false".

Could anyone tell me why this happened?
Thank you.

↓↓↓My function↓↓↓↓


Table
Boolean:1/0/0


《Scene_A》

Locker_1
If "tableCellValue(game.table, 1, 1)" = 1
Touch is pressed

Do
Change scene to "B"

Locker_2
If "tableCellValue(game.table, 2, 1)" = 1
Touch is pressed

Do
Change scene to "B"

Locker_3
If "tableCellValue(game.table, 3, 1)" = 1
Touch is pressed

Do
Change scene to "B"


《Scene_B》

Clear Button

(Function.1)
If "tableCellValue(game.table, 1, 1)" = 1
Touch is pressed

Do
Change Table Value:
Table:game.Table
Row:2
Column:1
Value:1

Change scene to "A"

(Function.2)
If "tableCellValue(game.table, 2, 1)" = 1
Touch is pressed

Do
Change Table Value:
Table:game.Table
Row:3
Column:1
Value:1

Change scene to "A"

Comments

  • SocksSocks London, UK.Posts: 12,436Member
    edited March 9

    @Weiyu said:
    Clear Button

    (Function.1)
    If "tableCellValue(game.table, 1, 1)" = 1
    Touch is pressed

    Do
    Change Table Value:
    Table:game.Table
    Row:2
    Column:1
    Value:1

    Is Locker 1 true ?

    Yes . . . . so now change Locker 2 to true.

    Now Locker 1 and Locker 2 are true.

    @Weiyu said:

    (Function.2)
    If "tableCellValue(game.table, 2, 1)" = 1
    Touch is pressed

    Do
    Change Table Value:
    Table:game.Table
    Row:3
    Column:1
    Value:1

    Is Locker 2 true ?

    Yes . . . . so now change Locker 3 to true.

    Now Locker 1 and Locker 2 and Locker 3 are true.

  • tatiangtatiang Posts: 10,697Member, Sous Chef, PRO, Senior Sous-Chef

    I think what you might be wanting to do is:

    《Scene_B》

    Clear Button

    (Function.1)
    If Touch is pressed
         If "tableCellValue(game.table, 1, 1)" = 1

              Do
              Change Table Value:
              Table:game.Table
              Row:2
              Column:1
              Value:1

              Change scene to "A"

         Otherwise

              (Function.2)
              If "tableCellValue(game.table, 2, 1)" = 1

              Do
              Change Table Value:
              Table:game.Table
              Row:3
              Column:1
              Value:1

              Change scene to "A"

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,855Member

    This is why I perfer a step integer, instead of Booleans.

  • pHghostpHghost London, UKPosts: 1,884Member

    @The_Gamesalad_Guru said:
    This is why I perfer a step integer, instead of Booleans.

    Yup! Either integers or indexes are great for this!

  • WeiyuWeiyu Posts: 136Member, PRO

    Thank you for all your assistance.
    The question has been decided. :D

    Tank you.

Sign In or Register to comment.