Do *if checks have to end with *finish?

I’m trying to use *if and *else statements to an encounter based on what trait variable the reader has. However, if all *if statements must end in *finish is this just impossible? I don’t want to end the scene, just add some flavor text.

My code looks like this (sorry if the formatting bugs):
You turn to look back at the large doorway you came in through. Even more people are trickling in and dispersing into groups. It’ll be a hell of a thing, but you should be able to get through them.

*if heroics
[Heroics] Ha! Pushing through this rabble will be easy. Party-goers are likely drunk, and there’s no easier group to power through than a crowd of drunkards. Making your way outside is simply a matter of walking with intention - they’ll move. If they don’t, well, an elbow in the right stomach can do wonders for making people scatter.

*elseif artfulroguery
[Artful Roguery] Three’s a crowd, and this many people- well, who knows what the hell this gathering could be called. A swarm? A horde? Regardless, it’ll be no matter to weave around them. You may have to dodge the occasional elbow, but drunk revelers are no match for good reflexes!

*elseif eagleeyes
[Eagle Eyes] You quickly spot a way through the mass of people milling near the entrance. It won’t actually be that hard to slip out, no need to be dramatic.

*else
It takes some maneuvering, some elbows to the face, and an occasional elbow of your own, but you manage to get through the door and back outside.

Upon exiting you are greeted by cool air and a marked drop in noise. You made the right choice, even if it meant leaving Brinley to his misery. Honestly, being late may even have helped in your escape. You shudder to think about the people at the far end of the banquet hall, a half a thousand people between them and the only way out.

If you use *if, in itself, then no. If you use *if and *else, then you need a *goto or *finish.

Your assumption is wrong, you don’t have to finish the scene at the end of each condition in an if block.

That’s a bummer. Do you have a recommendation for how to create the flavor text I’m going for without using *if and *elseif type statements, by chance? I can’t just use *if statements as multiple of these traits could fire and I wanted it to prioritize certain ones if possible — hence the heirarchy in the code. I know of multireplace but that only works for one variable at a time as far as I know.

Using the IDE it pulled an error and said I can’t go to *elseif or *else without using *goto_scene or *finish. However I can’t only use the *if statements either since multiple traits could be true in this instance, fire off a solution, and it wouldn’t make sense.

You’ll just have to use *goto and *label, right after you build your *if and *else code. Personally, I just use *if in itself, as my code is heavy on categorical variables, but anyway, if you need the hierarchy, you’ll just need a *goto after every block, and a *label for the next section.

2 Likes

^This.
I almost never use *else, *if is fine for most applications.

If you don’t want it to pick up multiple *if statements in a block, you can easily *goto a label within the if statement so it only picks up a single piece of flavour text.

You can also make a “trigger variable” if that’s easier so once it’s picked up an if statement in a block it won’t pick up any more. Just reset it when you need to use it again.

example

`*temp usedvariable 0

*if (var1 = "yes") 
   *set usedvariable 1
   text here

*if ((var 2 = "yes") and (usedvariable = 0))`
   Different text here.

More story

*set usedvariable 0


*if (var3 = "yes") 
   *set usedvariable 1
   text here

*if ((var 4 = "yes") and (usedvariable = 0))`
   Different text here.
2 Likes

You can change the implicit control flow in that case.

Throw this in your startup file

*create implicit_control_flow true

You can take a look at the documentation for more details

But keep in mind that you have to be more careful when planing your branches when doing this because you have any more checks to keep you from taking the player to “dead” branches.

5 Likes

I don’t know what error messages the IDE is throwing, but an *if/*else block works just fine with *goto, not *goto_scene.

*if heroics
  Heroic flavor!  
  *goto next
*elseif artful
  Artful flavor!
  *goto next
*else
  Flavorlessness!
  *goto next
*label next

This will not end the scene. Unless you’re wildly allergic to use of *goto/*label (in which case turn on ICF like quartz suggested), this seems like the way to go.

3 Likes