It is illegal to fall in to an *else statement

I know once this error is fixed, I’ll have a thousand others coming up. But I really cannot find an answer for this. As in the title, I’m getting an error of; Error: Chapter2 line 541: It is illegal to fall in to an *else statement; you must *goto or *finish before the end of the indented block.

This is what I'm having issues with.
*if ((Knowledge >= 1) and (Knowledge < 5))
	I start to vaguely recall something I'd read in our Library...It wasn't much, and didn't contain any specifics, but there were wards capable of keeping out creatures like the lycans or wolves. You didn't have to be a witch to do them either. I grab the door knob, and it turns, but I can't push--no doubt in thanks to the ward. "You won't open it that way," I hear Nyx say from behind me. "You have to counter the ward with magick."
	
	
	"Well, it's a good thing you're around, isn't it?" When I glance over my shoulder to him, he arched his brow at me.
*else 
	"You won't get in." Nyx dryly says behind me. "It has a ward, which is why it's still in tact."
	
	
	"A ward...? For creatures?" I step out of his way when he comes close, watching his eyes roam over the claw marks.
	
	
	He shakes his head, "For everyone. It's just strengthen specifically for them, so no matter how much they beat on it, it'll never break unless they counter it with their own magick."

Line 541 starts with the *else statement. I’ve seen some people say to put a *goto label, and I tried that, but there was still the error. I have this sort of set up a couple more times, and will likely continue to use it. So finding a solution would be great!

1 Like

In ChoiceScript you need to set a *goto (or *finish or *ending) when ending all *elses otherwise this error will happen.

*if ((Knowledge >= 1) and (Knowledge < 5))
	I start to vaguely recall something I'd...
	*goto after_else
*else 
	"You won't get in." Nyx dryly says behind me. "It has a ward, which is why...
	*goto after_else

*label after_else

This will fix the error. You can disable this requirement by using Implicit Control Flow.

2 Likes

You need a *goto at the end of every *if and *else that goes to a *label. The only way to avoid this is to add *create implicit_control_flow true at the beginning of your startup.txt file.

2 Likes

I’ll try it again, as it didn’t work before. Also, is there a way to hide an option until certain ones are picked?

2 Likes

Could you elaborate on what you mean exactly?

1 Like

Like, when coming to a choice and having all the options listed, is it possible to have any of them unselectable until a certain obligation is made? Say, below, to be able to choose #go over there, you have to choose #do this and #do that first. Until the player does, #go over there is greyed out.

*choice
   #do this
   *goto blah
   #do that
   *goto blah_blah
   #go over there
   *goto stuff_happening

Yes, use if or selectable_if on choice options.

2 Likes

Cool, cool! Everything works so far, although it keeps saying certain lines are uncovered, or untested?

Summary

The untested are these two lines: *goto_scene Chapter2 and *goto_scene Chapter3. It also claims the *goto_scene Chapter2 is uncovered.

Another “error” came up saying: Chapter3 line 2: WARNING there is no next scene; *finish will end game. Use *ending instead. despite not having any text in Chapter3 yet.

Unreachable lines: Some code that will never be reached. Usually something that is below a *goto.

Finish will end game: You have to set your chapter files at the top of the startup file. Use *finish to transition to the next scene instead of a direct *goto_scene. *finish will just jump to the next scene on the list while *ending will end the game regardless of where its set.

1 Like

Ohhhh, so all I have to do is put *finish at the end of the chapters? I thought I needed *goto, so I wasn’t sure.

*finish will end the chapter and jump to the next available scene in the scene list in your startup. It might throw an “error” if there are none and tell you to use an *ending instead. So if you’re having issues with that, make sure that there’s another scene after the current scene in your *scene_list.

*goto_scene is helpful if there are certain starting points in the next scene you’d prefer to, well, start at, based on variables (For instance, you could *goto_scene chapter2 label2- chapter2 is chapter name, label2 is the *label to jump to). Or if your game diverges into different scene.

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