Problems with *elseif

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.

Please help.

(oddly, I tried indenting the *elseifs and it only displayed the last one and still gave me the error.)

You need to use a *goto or *finish command after each *if command.
It looks like this:

*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. 
        *finish

Using *if and *elseif requires 2 more things, an else, and directions to send the user somewhere. For example,


*if a > 40
  *goto End
*elseif a > 60
  *goto End
*else
  *goto End

*label End
*ending

You should change your code to use ifs:


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. 
*if agile > 60
	In gym class the next week, you smoke every other player, eventually ending up victorious. You become famous school-wide.
*comment endif/

*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.
*if friendly > 60
	You become so popular that you are elected student president of the school. You weren't even running.
*comment endif/

*if determined < 40
	Your survival skills are bar none. You live to the ripe old age of 120.	
*if determined > 60
	cccccccombo breaker!!!
*comment endif/

*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!
*if 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

Also, I don’t think that *elseif is a proper command in choicescript.
It should be either *if or *else

As it stands right now, there is also a possibillity that nothing will be displayed, for instance if all stats are within 41 - 59, so you ought to change those to say *if (agile < 40) and *if (agile >= 41) or so, to catch Everything. And if you want to display one paragraph per stat at once then use only *ifs like JimD said, otherwise you’ll need to change the *elseifs into *else and insert *labels and *gotos. I would also suggest that you start using brackets around your conditions, *if (variable condition), this will help you out once you start using multiple conditions.

*if ((a = 1) and (b = 2))
*if ((a = 1) or (b = 2))
*if (((a = 1) and (b = 2)) and (c = 3))

Pay close attention to how many brackets you use though.