#### Howdy, Stranger!

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

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

Posts: 201Member, PRO
edited March 2017

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"

• London, UK.Posts: 12,821Member
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.

• Posts: 11,297Member, 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"

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

• Posts: 9,901Member

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

• London, UKPosts: 2,282Member