Exiting a Loop? (RESOLVED)

Hi! I’m making a small little game for one of my classes, and I’m running into some trouble.

The game goes like this: there are about 6 to 8 questions that you can access in any order. When you get one correct, you get 15 points. If you get it wrong, you lose 15 points. You start with 50 points. You win at 100 points, and lose at 0 points.

Since you can access the questions in any order, I looped the ends of every question back to the initial “select question” scene. I have a *hide_reuse in place for these options so that no one can do the same question again. Exception being, after finishing a question, the player hits 0 or 100 points, in that case I have a *goto to either the good_end or bad_end scene.

The problem comes in when the player has gotten an equal number of questions wrong as they have right. They will be sent back to the question selection screen because they have hit either 0 or 100, and then… what?

So I was wondering if there was a way for me to exit this loop. Maybe by hiding an additional option (or just having it greyed out?) that would only appear once all the others have been picked? Is that possible?

Or is there no way to script this scenario and I have to rethink the entire thing?

Edit: Nevermind, I found my solution in another thread ahahaha

If you put a

*if (points > 0) and (points < 100)
    then something happens here
    *goto where you need to go to

I assume this is what you want?

3 Likes

I’ve actually resolved it a different way

*choice
*hide_reuse #option 1
*goto scene1
*set var +1
*hide_reuse #option 2
*goto scene2
*set var +1
*if var =2
#option 3
*goto bad_end

Although your’s is an interesting solution as well. Thanks for sharing!

1 Like

Or
*choice

*selectableif var=2
#option3
*goto bad_end

Your *set var +1 is dead code must be used BEFORE you *goto anywhere.

If they have an equal number right as they do wrong then they’ll have exactly 50 points. Any score between 1 and 99 (including a 50) will be sent back to choose another question according to your own guidelines above. You need to define what you want to have happen if the game ends and the score is still between 1 and 99.

@Pace675 is entirely right about your dead code.

Ah I didn’t pay attention when I was typing out my reply there (I’m on my phone). In my actual game it’s working perfectly. Thanks :slight_smile: