I need help with a coding mini-game!

I am currently coding my first story and I am doing a mini-game. I’m wanting the reader to click on the items and choose ONLY three supplies. But for some reason it’s not acting the way I want it to. I also want their choice to show up later in the story too. I want like a remembering choice code… if that makes sense?

Here is the code I have so far:

INT. OVERGROWN GROCERY STORE - DAY
@set hsl 0 0 -52 no_colorize with blendMode Normal to 100% in 0
@zoom reset
@overlay BLANKETS create AND overlay BLANKETS opacity 1 AND overlay BLANKETS shifts to 158 251 in zone 1 AND overlay BLANKETS scales to 0.370 0.370 AND overlay BLANKETS moves to layer 0 AND overlay BOOK STACK 4 create AND overlay BOOK STACK 4 opacity 1 AND overlay BOOK STACK 4 shifts to 73 234 in zone 1 AND overlay BOOK STACK 4 scales to 0.256 0.256 AND overlay BOOK STACK 4 moves to layer 3 AND overlay BRICK create AND overlay BRICK opacity 1 AND overlay BRICK shifts to 216 95 in zone 1 AND overlay BRICK scales to 0.105 0.105 AND overlay BRICK moves to layer 0 AND overlay BROKEN KNIFE create AND overlay BROKEN KNIFE opacity 1 AND overlay BROKEN KNIFE shifts to 91 173 in zone 1 AND overlay BROKEN KNIFE scales to 0.181 0.181 AND overlay BROKEN KNIFE moves to layer 0 AND overlay FIRST-AID OPEN create AND overlay FIRST-AID OPEN opacity 1 AND overlay FIRST-AID OPEN shifts to 276 175 in zone 1 AND overlay FIRST-AID OPEN scales to 0.294 0.294 AND overlay FIRST-AID OPEN moves to layer 0

@VES stands screen left AND VES faces left AND VES is idle_rear

@pause for a beat

&zoom on 150 162 to 182% in 1 using easein
@VES walks to spot 1.280 8 -6 in zone 1 in 1 AND VES is idle_rear

@speechbubble reset
@speechbubble is 155 244 to 70%
NARR
| bold |You are now entering in a mini-game.
NARR
| bold |Move the screen to find supplies and click one once you’re done!
NARR
| bold , color:red |You can only choose three items.
NARR
| animation:flash , color:red , bold |You have ten seconds to decide.

@pause for a beat

label THREE_SUPPLIES
@zoom on 150 162 to 182% in 1 using easeout

tappable [pan:1]
“BLANKETS” {

@zoom on 179 291 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
Blankets…
Definitely will be useful soon.
Winter is coming up.

choice
“Take the blankets” {

@overlay BLANKETS opacity 0 in .5

} “Leave the blankets” {

goto THREE_SUPPLIES

}

} “BOOK STACK 4” {

@zoom on 54 298 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
Books…?
Hmm…
Could be nice for the kids…

choice
“Take the books” {

@overlay BOOK STACK 4 opacity 0 in .5

} “Don’t take the books” {

goto THREE_SUPPLIES

}

} “BROKEN KNIFE” {

@zoom on 91 165 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
Could be useful; could be useless.
May not be sharp enough though.

choice
“Take the knife anyway” {

@overlay BROKEN KNIFE opacity 0 in 1

} “Leave it.” {

goto THREE_SUPPLIES

}

} “FIRST-AID OPEN” {

@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
| italic |This| reset | is what I was looking for.
VES
It’s perfect. It has everything we needed!
VES
But how did someone not grab this already?
It’s completely full.

choice
“Grab the first-aid !!” {

@zoom on 280 201 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
I’d be stupid to not take this.

@overlay FIRST-AID OPEN opacity 0 in 1

} “Don’t… leave it for someone else” {

goto THREE_SUPPLIES

}

}

I would use gains so when the reader clicks to take the blanket, use:

gain Blanket

And when you want to remember this choice you can do:

if (Blanket) {
CODE
} else {
}

This probably explains it better than I do:

And to only allow the reader to choose 3 items, I would use a point system so every time an object is claimed, use:

@CHAR +1

Could be any character it doesn’t really matter and then later:

if (CHAR>3) {
CODE FOR HAVING TOO MANY OBJECTS
} else {
goto THREE_SUPPLIES
}

Once again the link above should explain it better than I can, hope this helped!

You are a lifesaver! Thank you so much!! <3

1 Like

No worries!! :yellow_heart:

1 Like

Hey, so I added the else/if commands, but when I go to play the mini-game and choose an item it goes straight to the end of the mini-game after choosing one item, when it’s supposed to be three. How do I fix this?

Here is my coding:

label THREE_SUPPLIES
@zoom on 150 162 to 182% in 1 using easeout

tappable [pan:1]
“BLANKETS” {

@zoom on 179 291 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
Blankets…
Definitely will be useful soon.
Winter is coming up.

choice
“Take the blankets” {

@overlay BLANKETS opacity 0 in .5
if (BLANKETS) {
@ZOMBIE1 +1
} else {

if (ZOMBIE1>3) {
goto END_OF_THREE
}

}

} “Leave the blankets” {

goto THREE_SUPPLIES

}

} “BOOK STACK 4” {

@zoom on 54 298 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES (idle_rear)
Books…?
Hmm…
Could be nice for Ash…

choice
“Take the books” {
@overlay BOOK STACK 4 opacity 0 in .5
if (BOOK STACK 4) {
@ZOMBIE1 +1
} else {

if (ZOMBIE1>3) {
goto END_OF_THREE
}

}

goto THREE_SUPPLIES

} “Don’t take the books” {

goto THREE_SUPPLIES

}

} “BROKEN KNIFE” {

@zoom on 91 165 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
Could be useful; could be useless.
May not be sharp enough though.

choice
“Take the knife anyway” {

if (BROKEN KNIFE) {
@ZOMBIE1 +1
} else {

if (ZOMBIE1>3) {
goto END_OF_THREE
}

}
@overlay BROKEN KNIFE opacity 0 in 1

goto THREE_SUPPLIES

} “Leave it.” {

goto THREE_SUPPLIES

}

} “FIRST-AID OPEN” {

@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
| italic |This| reset | is what I was looking for.
VES
It’s perfect. It has everything we needed!
VES
But how did someone not grab this already?
It’s completely full.
@zoom on 280 201 to 476% in .1

@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES
I’d be stupid to not take this.

choice
“Grab the first-aid !!” {

if (FIRST-AID OPEN) {
@ZOMBIE1 +1
} else {

if (ZOMBIE1>3) {
goto END_OF_THREE
}

}

@overlay FIRST-AID OPEN opacity 0 in 1

goto THREE_SUPPLIES

} “Don’t, leave it.” {

goto THREE_SUPPLIES

}

}

label END_OF_THREE

&VES spot 0.801 73 165 in zone 1 AND VES faces right AND VES is dustoff_neutral_loop
@zoom on 0 230 to 197% in .2 using easeout

1 Like

Make sure to add the gains if you want the choice to be remembered! Also did it work the first time you played it? If so, it just means you have to reset your points every time you load the story. If I remember correctly, you do this in the navigation tab when previewing your story. Let me know if this works (sorry it’s been a while since I’ve done proper branching :sweat_smile:)

1 Like

So I added the gains and I even had a big Episode Author to help me and I still can’t get it right :sob: the mini-game crashes like I can’t even click on anything even if I’m not playing the mini-game. I tried reviewing another scene and it won’t allow me to click through.

Here if what I have:


1 Like

You do have an error on line 355 so maybe try to fix that. Could you define what you mean by crashes?? Like do you get something above your previewing that says “error:” followed by a number? If so, there’s probably an error in your coding somewhere that you’ll just have to find and fix. Usually, it’s around where the story has began to crash (like you can’t tap to continue as you said) and you can refresh the page to preview your story again normally and find where the problem occurs

1 Like

Yeah every time I try to fix my mini-game it always says that an opening bracket doesnt have a matching closing bracket, and I’ve checked it many times, it does. I’m so confused. The crashing thing- it won’t even allow me to get through the mini-game on mobile whenever I play it on my phone to see if it looks good. After the dialogue, “You have ten seconds to decide.” it won’t let me click past that. It just freezes. I’m not sure how to explain it.

Yeah the crashing sounds like an error in the code but I’m not sure where :thinking:

Could you post the whole script of the game please?

Yes of course!

INT. OVERGROWN GROCERY STORE - DAY
@set hsl 0 0 -52 no_colorize with blendMode Normal to 100% in 0
@zoom reset
@overlay BLANKETS create AND overlay BLANKETS opacity 1 AND overlay BLANKETS shifts to 158 251 in zone 1 AND overlay BLANKETS scales to 0.370 0.370 AND overlay BLANKETS moves to layer 0 AND overlay BOOK STACK 4 create AND overlay BOOK STACK 4 opacity 1 AND overlay BOOK STACK 4 shifts to 73 234 in zone 1 AND overlay BOOK STACK 4 scales to 0.256 0.256 AND overlay BOOK STACK 4 moves to layer 0 AND overlay BRICK create AND overlay BRICK opacity 1 AND overlay BRICK shifts to 216 95 in zone 1 AND overlay BRICK scales to 0.105 0.105 AND overlay BRICK moves to layer 0 AND overlay BROKEN KNIFE create AND overlay BROKEN KNIFE opacity 1 AND overlay BROKEN KNIFE shifts to 91 173 in zone 1 AND overlay BROKEN KNIFE scales to 0.181 0.181 AND overlay BROKEN KNIFE moves to layer 0 AND overlay FIRST-AID OPEN create AND overlay FIRST-AID OPEN opacity 1 AND overlay FIRST-AID OPEN shifts to 248 177 in zone 1 AND overlay FIRST-AID OPEN scales to 0.294 0.294 AND overlay FIRST-AID OPEN moves to layer 0

@VES stands screen left AND VES faces left AND VES is idle_rear AND VES moves to layer 1

&zoom on 150 162 to 182% in 1 using easein
@VES walks to spot 1.280 8 -6 in zone 1 in 1 AND VES is idle_rear

@speechbubble reset
@speechbubble is 155 244 to 70%
NARR
| bold |You are now entering in a mini-game.
NARR
| bold |Move your finger across the screen to find supplies in the room and click on them once you do!
NARR
| animation:flash , color:red , bold |You can only choose three items.
NARR
| bold , color:red |You have ten seconds to decide.

label three_supplies

if (ZOMBIE1 =3) {
goto end_of_three
} else {
goto three_supplies
}

@zoom on 150 162 to 182% in 1 using easeout

tappable [pan:1]
“BLANKETS” {

@zoom on 179 291 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES (talk_neutral_loop_rear)
Blankets…
VES
Definitely will be useful soon.
VES
Winter is coming up.
VES
Should I take them?

choice
“Yes!” {

@ZOMBIE1 +1

gain BLANKETS

@overlay BLANKETS opacity 0 in .5

goto three_supplies

} “No, leave the blankets.” {

goto three_supplies

}

} “BOOK STACK 4” {

@zoom on 54 298 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES (talk_neutral_loop_rear)
Books? I don’t think they’ll be beneficial, but…
VES
Perhaps Ash would like them.
VES
Should I take them?

choice
“Yes.” {

@ZOMBIE1 +1

gain BOOK STACK 4

@overlay BOOK STACK 4 opacity 0 in .5

goto three_supplies

} “Don’t take the books.” {

goto three_supplies

}

} “BROKEN KNIFE” {

@zoom on 91 165 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left
VES (talk_neutral_loop_rear)
A broken knife?
VES
A weapon is a weapon, but may not be sharp enough. Should I take it anyway?

choice
“Yes.” {

@ZOMBIE1 +1

gain BROKEN KNIFE

@overlay BROKEN KNIFE opacity 0 in 1

goto three_supplies

} “Leave it.” {

goto three_supplies

}

} “FIRST-AID OPEN” {
@zoom on 280 201 to 476% in .1
@speechbubble reset
@speechbubble is 79 247 to 70% with tail_top_left

    VES
| italic |This| reset | is what I was looking for.
    VES
It has everything!
    VES
I'd be stupid to not take this.

choice
“Take it!!!” {

@ZOMBIE1 +1

gain FIRST-AID OPEN

@overlay FIRST-AID OPEN opacity 0 in 1

goto three_supplies

} “I’m stupid enough to leave it… so leave it.” {

goto three_supplies

}

}

label end_of_three

@pause for a beat

&VES spot 0.801 73 165 in zone 1 AND VES faces right AND VES is dustoff_neutral_loop
@zoom on 0 230 to 197% in .2 using easeout

Hmm I really don’t know, all your code looks good :thinking:

Maybe there’s a problem with episode and you may need to send a support ticket for crashing?? I’m not sure, @Dara.Amarie could you have a look?

1 Like

So if you get this error and all brackets are there, then the error is actually somewhere inside those brackets and the script can’t pin point it.

The issue is because flag (gain) names cannot contain spaces or special characters. Flag names can only consist of letters, numbers, and/or underscores.

3 Likes

So, the overlays that have spaces such as Book Stack 4 isn’t allowed?

Your overlay names are fine. The problem is your gain/flag names.

1 Like

How do I fix that?

Just change their names. Remove the spaces and the dash.

1 Like

Thank you so much :slight_smile: