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

WeiyuWeiyu Member Posts: 216
edited March 2017 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.Member Posts: 12,822
    edited March 2017

    @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 Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    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"

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

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

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

  • pHghostpHghost London, UKMember Posts: 2,342

    @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 Member Posts: 216

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

    Tank you.

Sign In or Register to comment.