Help with timed "if/else" choice coding a mini-game

I am working on a mini-game code with timed choices.

Basically it shows you the scene, then you have 3 seconds to make the right choice for where your characters goes. both choices work, but the “else” code doesn’t seem to.

If you don’t make a selection it goes with the last choice and ignores the “else” part.

I’ve uploaded a screenshot of the code.
Please help if you can.

I’ve been working on the mini-game for almost 12 hours now (so maybe I’m just tired), and I obviously don’t want the answer to always be the first one in the timed choice (It kind of makes it easy)

I’ve never really been able to get the if/else code to work properly, but if anyone could give me some pointers that would be great!
I’d like to start adding more stuff like that in my stories.

Nothing can be done about the last option getting selected. It always gets selected by default for timed choices (which I find really irritating but you can’t change it :woman_shrugging: ). You can do one thing though. You can give three choices. That way it will become interesting. However your code will increase so get some sleep first. :slight_smile:

1 Like

Or you can make an option “Left” and then copy the code for the choice “up” there.

But I don’t know if the background you are using will help that.

So you were saying the if/else code from line 218 - 226 does not work?
There’s no gain in your timed choice so I suppose you are using the choice naming to get to the if/else code.

Give your choice a name in line 150:
choice (CHOICE_NAME) [timed: 3] “Up”{
.
.
.

For the if/else code on line 218:
if (CHOICE_NAME is “Up”){
.
}else{
.
}

1 Like

Actually, there’s a way to make a different option to be the default option!

choice [timed:5:Right] ← what you write instead Right, will be the default option when the time’s up!^^

3 Likes

Oh. Really? I didn’t know about that! Thank you so much! :blob_hearts:

2 Likes

It looks like that one works!
You don’t need it if the bottom answer is still the wrong answer but that makes it easier! Thank you!

1 Like

I’ll try that code next time I’m using the if/else code. Thank you!

I will make a three choice one next time around, and I did get some sleep! Thank you!

1 Like

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