Labels in if commands?

Quick question, I’m trying to write a very specific stat check but it’s under an *if command, so my question is: can you put a *label under an *if statement?
My coding looks like this:

*if shutit = "false"
	*label intelligencecheck
	"I will answer one question truthfully," the goat tells you in a soothing feminine voice. "Choose wisely. There is only one."
	*fake_choice
		#"How do I know you'll be honest?"
			*set responsible %-5
			*if asset = "intelligence"
				*goto intellicengecheck
			*if asset != "intelligence"
			"How do I even know you'll tell me the truth? I don't know what you are."
1 Like

(then ignore me) :wink:

1 Like

oops, okay thank you, appreciate it :slight_smile:

1 Like

I’m fairly sure this is possible, but I never tried it. Did you try? You got an error?

I remember there is a bug in CS that if you do this inside a *choice or *fake_choice (as in going to a label inside them) they will always require a *goto at the end even if they’re *fake_choices (who don’t require *gotos at the end), so I don’t recommend this practice inside choice options.

Even then I don’t recommend this practice at all because when you *goto that label inside the if, you won’t check the *if requirement so you might end up inside it if shutit was true for example, which may not be what you want.

Also, to use boolean variables, don’t place them inside quotes (correct is *if shutit = false)

I put labels under if commands. As long as you indent properly, it’s fine.

4 Likes

Important note, here. I agree.

Haven’t tested it tbh, I wanted to be completed with writing before testing and editing, but I will definitely try because the *if asset = "" are important to the story, also thank you for pointing the boolean variable out, for some reason it’s correct in my coding but i think i added the quotes by mistake to my post (for some reason lol)

Yes but I’m referring to the location of the *label, be careful you don’t set it inside *ifs and end up skipping the condition when you didn’t want to.

It can work, but you will be comparing a text variable that has the content “false” inside it. If your variable is also a string variable that has the same content, it will work.

Another hint is that you can use *else commands instead of repeating the *if and negating the condition.

More here:

Actually, now that I think about it, instead of having *if shutit = false it would make more sense to do *elseif ((shutit = false) and (asset = "intelligence")) and then just have a catch-all *else ((shutit = false) and (asset != "intelligence")) (with the obvious *if shutit = true at the beginning of this scene) and create a *goto command after each of those. Thank you for the help!

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