How to use *if and boolean for scenarios?

Perhaps the question was not aptly phrased, but I’ll do my best to explain it here. I’m rather new to Choicescript, having just started yesterday.

What I want to know is, how should I structure the *if command for whole scenes instead of choices? And not based on stats, either. Like, for example:

Let’s say the main character talks to Daria. If character has complimented Daria, then (for example):
*set daria_compliment true

Of course, we would have to set up [*create daria_compliment true] in the startup

Fast forward several scenes later:

*if daria_compliment true
Daria gives you a kiss! “I love you,” she declared. The two of you live happily ever after.
*finish
*else
Daria just smiles at you. You stay good friends.
*finish

If it helps, I’ve mostly been going through the ChoiceScript introduction guide. Any help will be greatly appreciated!

I almost forgot. I’ve tried structuring it the way I mentioned above ^ but keep receiving error messages.

It’s

*if daria_compliment = true

or

*if daria_compliment

or (if and this is only really something coders will probably use naturally)

*if not(daria_compliment)

Thank you! I will try it out straightaway

Actually this is something that’s always confused me as well. Does there have to be a choice statement in there? Or can you just have something like

Story paragraph ends here

*if ( element = "water" )
Storyline for water

*if (element = "fire" )
Storyline for fire

And just have the story continue without having to make a choice? (I’ve been trying to engineer choices to split the storylines which isn’t always easy)

Yeah, I’m still trying to figure it out. I ran into another error again that says I’m missing a VAR or something like that… I’ll post the whole message once I get to a computer. I’m using my phone right now

@Jacic can you tell me how you’ve been doing it so far? And has it worked, despite being difficult?

I haven’t tried using it without a choice statement (Guess the easiest thing to do would be for me to just to try it out and see if it works).

It works fine otherwise with the *if choices. The only issue is you sometimes end up with single selectable choices because the others are hidden which most people don’t like in games.

This will definitely work:

And they
*if element = "water"
  went to the world of water.
  *goto_scene water
*if element = "fire"
  went to fire world.
  *goto_scene fire
lived happily ever after.
*finish

If element is water or fire, the MC goes to a specific scene. If the element is neither water nor fire, the MC reads “And they lived happily ever after.”, and the game ends.

Makes sense! I’ll try it out. Thank you!

Edit: THANK YOU SO MUCH it works!! I am forever indebted to you!

Also as well… With the right spaces under the if statement. You can add more than one line, or several paragraphs as in example here…

 *if s = true
   "Ahh...It is good to see a recruit that knows to solute their commanding officer. It seems you paid attention while you were in the academy." She says with almost a happy tune to her voice. But that is short lived.

*if s = false
   "Don't you know to solute your commanding officer or don't you even care. I have been doing this for a very long time and I require every one to show some respect. Is that understood!" She says with almost a soar note.

   "Yes commander, that is completely clear." He says almost half aware that the others are looking in his direction.

Does anyone know how I can do something like…

*if xp >0 and <31

I have been coming up with an unexpected boolean operator error, even if I rap it in parentheses.

I want a list of the that goes similar to this…

*if xp >0 and <31
*set lvl 1
*return
*if xp >30 and <71
*set lvl 2
*return

Any ideas

Like this:

*if ((xp >0) and (xp <31))

etc.

I tried that… but it kept saying unexpected boolean.

I have figured out that it works if i only use the less then number for instance.
*if xp <71
*set lvl 2
*return
*if xp <122
*set lvl 3
*return

If its not smaller than the first… it moves down the list until it finds an acceptable value.

That’s odd. A boolean is a variable that’s either true or false, while this bit of code only makes use of numerical variables. Or are you forgetting brackets somewhere?

Anyway, it looks like you found a workaround for your problem, so it doesn’t really matter anymore. Good luck.