MiniGame tappable overlays - help correct my script

I made a mini game where you have to click the overlays in the correct order, it works if you click on the correct one each time, but if you click the wrong one and then the correct one, it says the correct one is wrong. I can’t work out why, can anyone help?

INT. BAKERY COUNTER

@overlay FLOUR create
@overlay 5526051697983488_FLOUR shifts to 150 284 in zone 1
@overlay 5526051697983488_FLOUR scales to 0.424 0.424
@overlay 5526051697983488_FLOUR moves to layer 1
@overlay FLOUR opacity 1
@overlay SUGAR create
@overlay 5526051697983488_SUGAR shifts to 22 144 in zone 1
@overlay 5526051697983488_SUGAR scales to 1.000 1.000
@overlay 5526051697983488_SUGAR moves to layer 2
@overlay SUGAR opacity 1
@overlay BUTTER create
@overlay 5526051697983488_BUTTER shifts to 149 -7 in zone 1
@overlay 5526051697983488_BUTTER scales to 1.108 1.108
@overlay 5526051697983488_BUTTER moves to layer 3
@overlay BUTTER opacity 1
@overlay EGGS create
@overlay 5526051697983488_EGGS shifts to 18 443 in zone 1
@overlay 5526051697983488_EGGS scales to 0.478 0.478
@overlay 5526051697983488_EGGS moves to layer 4
@overlay EGGS opacity 1

label bakery_trial

    NARRATOR
What ingredient goes first?

tappable
“FLOUR” {
gain FLOUR
} “BUTTER” {
gain BUTTER
} “EGGS” {
gain EGGS
} “SUGAR” {
gain SUGAR
}

if (FLOUR) {
NARRATOR
Wrong ingredient, try again.
goto bakery_trial

} elif (BUTTER) {
NARRATOR
Correct! Next ingredient…
goto bakery_round_2

} elif (EGGS) {
NARRATOR

Wrong ingredient, try again.

goto bakery_trial

} elif (SUGAR) {
NARRATOR
Wrong ingredient, try again.
goto bakery_trial

}

label bakery_round_2

    NARRATOR
What's next?

tappable
“FLOUR” {
gain FLOUR2
} “BUTTER” {
gain BUTTER2
} “EGGS” {
gain EGGS2
} “SUGAR” {
gain SUGAR2
}

if (FLOUR2) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_2

} elif (BUTTER2) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_2

} elif (EGGS2) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_2

} elif (SUGAR2) {

    NARRATOR
Correct! Next ingredient..

goto bakery_round_3

}

label bakery_round_3

    NARRATOR
Which ingredient next?

tappable
“FLOUR” {
gain FLOUR3
} “BUTTER” {
gain BUTTER3
} “EGGS” {
gain EGGS3
} “SUGAR” {
gain SUGAR3
}

if (FLOUR3) {

    NARRATOR
Correct! Next ingredient..

goto bakery_round_4

} elif (BUTTER3) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_3

} elif (EGGS3) {
NARRATOR

Wrong ingredient, try again.

goto bakery_round_3

} elif (SUGAR3) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_3

}

label bakery_round_4

    NARRATOR
The last ingredient is..

tappable
“FLOUR” {
gain FLOUR4
} “BUTTER” {
gain BUTTER4
} “EGGS” {
gain EGGS4
} “SUGAR” {
gain SUGAR4
}

if (FLOUR4) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_4

} elif (BUTTER4) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_4

} elif (EGGS4) {
NARRATOR
Correct! Next ingredient…
goto bakery_round_4_end

} elif (SUGAR4) {
NARRATOR
Wrong ingredient, try again.
goto bakery_round_4

}

label bakery_round_4_end

INT. BAKERY KITCHEN
NARRATOR
Congratualtions!

Do the overlays happen to have a big transparent space around them?

I changed it to include else now I get an error

I believe this has something to do with your gains :thinking::thinking: If they select one wrong, then your script will forever know that they have a wrong answer, because gains cannot be lost. I think your best bet here would be to use the point system. What you could do is something like this …

label bakery_trial
tappable
"FLOUR"{
@MG=0
}"BUTTER"{
@MG=1
}"EGGS"{
@MG=0
}"SUGAR"{
@MG=0
}

Then…

if (MG=0){
NARRATOR
Wrong ingredient, try again.
goto bakery_trial
}else{
NARRATOR
Correct! Next ingredient...
goto bakery_round_2
}

The same thing would be repeated for each round, but add a point for each round. Changing the 0 from wrong to being 1 for round 2, 2 in round 3, and 3 in round 4. Then the points for correct would match the round number. Round 1 was 1, round 2 is 2, and so on. Create a character to match the points added. Character name is up to you, I just chose MG because it’s quick and easy (stands for mini-game)

“else” shouldn’t have anything connected to it. It’d just be…

}else{
#else coding here
}

Thank you, i couldn’t get it to work using your way exactly but i used it as a guide and got it working. Thank you so much!

Some advice, you don’t actually need to use if/elif/else. You can just put the wrong/correct dialogue inside each tappable choice like this:

tappable
“FLOUR” {
NARRATOR
Wrong ingredient, try again.
goto bakery_trial

} “BUTTER” {
NARRATOR
Correct! Next ingredient…
goto bakery_round_2

} “EGGS” {
NARRATOR
Wrong ingredient, try again.
goto bakery_trial

} “SUGAR” {
NARRATOR
Wrong ingredient, try again.
goto bakery_trial
}

So you don’t need to use flags or the points system or the if/elif/else at all for your game.

1 Like

Thank you, that looks so much easier :joy: :sweat_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.