I’m having trouble with the *choice feature. So, I used it and tried to make it work, but it just keeps giving me an error message.
The error I’m getting is: startup line 25: invalid indent, expected at least one ‘choice’
My code looks like this:
*choice
#Explore and discover this strange thing.. I'm not scared!
You peek outside by, to your confusion, nothing is wrong; instead, the world has turned white
with something that you don't yet understand; snow. Now that you've established that everything
is safe, you retreat to the den.
*finish
#That seems scary.. I'll just stay in the lair.
It's warm inside the lair. You stretch and curl up to sleep.
*finish
Indents are important in ChoiceScript, your code should look like this:
*choice
#Explore and discover this strange thing.. I'm not scared!
You peek outside by, to your confusion, nothing is wrong; instead, the world has turned white with something that you don't yet understand; snow. Now that you've established that everything is safe, you retreat to the den.
*finish
#That seems scary.. I'll just stay in the lair.
It's warm inside the lair. You stretch and curl up to sleep.
*finish
Ok, I’ll try~ Thanks for the advice!
It worked, thanks!!
Ok, so, I’m really sorry but… now I’m struggling with something else. >.<
I have a code like this:
*choice
#Male
Ok.
*set gender male
*page_break
#Female
Ok.
*set gender female
*page_break
But it says that " It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block." when I try to use this script…
Any help?
After using *choices and *ifs you have to finish with a *goto, so that the code knows where to go after it reaches that point.
The *gotos go to *label of a name you can define.
*choice
#Male
Ok.
*set gender male
*page_break
*goto afterGender
#Female
Ok.
*set gender female
*page_break
*goto afterGender
*label afterGender
Continue your game here...
Alternatively you can use *fake_choice, which doesn’t require a *goto at the end, and it will simply continue down when it finishes the choice code.
Also use this program to make coding easier, as well as handling indenting.
Oh. Hey. GUESS WHO’S HAVING PROBLEMS AGAIN >.<
My script looks like this:
*choice
#Claim the kingdom!
You grin. "I'll go for the kingdom!"
*goto KingdomClaim
#Claim more small villages.
You take to the air. "Starting small is a good idea."
*goto Town2Claim
And the error message is:
"It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block."
Was about to say that. Always look at the line number it mentions first. (Someone it’ll be elsewhere but more likely that’s where the problem is and you can work the problem out more easily.)
It should work like that, i cant see any problems. Also you don’t need to use *page_break after a choice as it does that automatically. Hope someone can help with that
Also, if your gender variable is a string variable, it wont recognise *set gender male . male should be “male” .
*choice
#Male
*set gender "male"
*goto scene
#female
*set gender "female"
*goto scene
*label scene
This should work. But the one you posted shouldn’t have been giving that error but non-existent variable error. So im not sure whats the problem there…
It’s probably that.
So maybe “male” an “female”. Assuming the startup variables are already made.
Edit: Nevermind, read the error message and it has nothing to do with that. I can only blame page_break.
Edit 2x: I tried creating variants of what you did, nope, no error messages at all. You might want to show us your startup variables.
Ok guys. I’m very new, so forgive me, but I’ve just discovered I was being an idiot.
The script BEFORE the gender was the one being wrong, NOT the gender script. Oh golly. I don’t know how I did that. Sorry guys~
Also, on a note before, cause i think no one corrected that:
If you have flavor-text (like the ok) a page_break is okay.
In fact:
If you have flavor-text, a page_break might help with the flow of the story if the text is not part of the narrative as such.
Otherwise it’ll appear above the next text body