So I’m writing a CS game about kids who make their way into the fae world and it’s throwing up an error I don’t understand.
I’ve set it up with 5 opposing pairs of stats:
Agile / Strong
Friendly / Aloof
Smart / Clever
Determined / Cautious
Which means I have 5 skills: Agile, Friendly, Smart, Determined.
In my ending.txt file, I want to display different messages depending on which stat of the pair was higher. Basically if you were more agile you get one message, if you were more strong you get a different message - for each of the 5 pairs.
To do this I’m using *if and *elseif to display one message or the other.
Here’s the bulk of my ending.txt file:
You arrive back in your house. No time has passed since you went into the Otherworld. *if agile < 40 When the school bully comes around, you give him a solid puch in the nose. He gives up the profession immediately. Everyone is so impressed that nobody tattles on you. Though they secretly whisper the story to anyone who missed it. *elseif agile > 60 In gym class the next week, you smoke every other player, eventually ending up victorious. You become famous school-wide. *if friendly < 40 Your loner status is cemented throughout the school. Anyone who's that much of a loner must be super-cool. A fan club for you develops and while you try to quash it it remains strong. *elseif friendly > 60 You become so popular that you are elected student president of the school. You weren't even running. *if determined < 40 Your survival skills are bar none. You live to the ripe old age of 120. *elseif determined > 60 cccccccombo breaker!!! *if smart < 40 You figure out a loophole that allows you to never go to school again but still be super-smart. Congratulations, you win at life! *elseif smart > 60 With careful application of your smarts you graduate with honors, get a scholarship to a prestigious ivy-leave college, and eventually create a must-have app that nets you billions. Congratulations, you win at life! *ending
When I run it in Firefox everything displays properly and appropriately depending on which stats I buffed. Except it displays the message
“ending line 41: It is illegal to fall in to an *else statement; you must *goto or *finish before the end of the indented block.”
line 41 is the last *elseif statement. If it runs and displays every message (including the last one), I don’t understand why I’m getting an error.
(oddly, I tried indenting the *elseifs and it only displayed the last one and still gave me the error.)