*If statement skipped over regardless of outcome

This issue is likely very easy to solve and I’m just too dumb to figure it out from the tutorials, but here it is!

I can’t tell if I’m not creating the variable right, if I’m writing the *if statement wrong or if I can’t use an *if statement outside of *choice.

When I run the game it simply doesn’t show anything for that part, not even the place *goto is supposed to lead to, it’s as if the *if statement doesn’t even exit

image

IIRC *create only works at the top of the startup file. Maybe moving it there will change things, if it’s not there already? It might be skipping both because the game doesn’t realize “eye” is a variable, so it doesn’t know what to do with the if/else statement.

edit: You could also use a *temp instead of *create, but I’m not sure if that would have to be at the top of the file it’s used in or not.

Neither of the two possible solutions you’ve suggested worked :c

How are you testing the files? what’s the output? is there any error?

This works for me. I just created a new startup.txt and wrote the following.

If eye = 1 then it will print both statements in both labels - but it definitely works as the ‘its alive’ / ‘its dead’ lines print correctly

*create eye 0

*if eye = 1
    It's alive
    *goto soldierpercpass
*else
    It's dead
    *goto cantseeeye

*label soldierpercpass
Eye is 1

*label cantseeeye
Eye is 0

Code:

*create eye 1

*script changeBackgroundColor("black")
*comment-end
*comment-start Race
You find yourself on a large stage, blinded by the lights beaming down on you and deafened by the excited screams of the audience before you.

*label race

You are not alone. There are several other people on the stage with you, along with strange, floating creatures. Their bodies seem to be made out of a single, large eye surrounded by flesh and flailing tentacles.
They are watching you with intensity, unblinking.

*if eye = 1
	It's alive!
	*goto soldierpercpass
*else
	It's dead!
	*goto cantseeeye

They are seeing a...

Output:

You find yourself on a large stage, blinded by the lights beaming down on you and deafened by the excited screams of the audience before you.

You are not alone. There are several other people on the stage with you, along with strange, floating creatures. Their bodies seem to be made out of a single, large eye surrounded by flesh and flailing tentacles. They are watching you with intensity, unblinking.

They are seeing a...

I’m using a local server as described in the tutorial. After I save the edits of the .txt file I refresh the browser. Works fine with any edits I make, so the issue isn’t there. There is no error for this.

Please put your code surrounded by 3 of this ` at the beginning and 3 at the end. or click the </> on top of where you write the reply so we can see the code properly.

It looks like it should work, but copy pasting your code into my startup file still isn’t doing it :c

Are the labels for soldierpercpass and cantseeeye in the same file?

Yes

I don’t know if it will help you, but I hope it does.
I recommend you to:
*create eye 0

Then when/if the character has the eye:
*set eye +1

With that, I think your coding with *if and *else should work.

Good luck!

Have you tried to use another method to try it like the randomtest or quicktest or something else?

Huh, it looks like there was an issue with the local server, the updates I was making weren’t going through anymore. I restarted it and now it seems to work. Thank you, everyone!

3 Likes

I just copied and pasted your code into CSIDE and altered it by adding the two labels to the bottom. Output below:

*create eye 1

*script changeBackgroundColor("black")
*comment-end
*comment-start Race
You find yourself on a large stage, blinded by the lights beaming down on you and deafened by the excited screams of the audience before you.

*label race

You are not alone. There are several other people on the stage with you, along with strange, floating creatures. Their bodies seem to be made out of a single, large eye surrounded by flesh and flailing tentacles.
They are watching you with intensity, unblinking.

*if eye = 1
	It's alive!
	*goto soldierpercpass
*else
	It's dead!
	*goto cantseeeye

They are seeing a...

*label soldierpercpass
Eye is 1

*label cantseeeye
Eye is 0

Output:

You find yourself on a large stage, blinded by the lights beaming down on you and deafened by the excited screams of the audience before you.

You are not alone. There are several other people on the stage with you, along with strange, floating creatures. Their bodies seem to be made out of a single, large eye surrounded by flesh and flailing tentacles. They are watching you with intensity, unblinking.

It's alive! Eye is 1

Eye is 0

Looks right to me - it skips over the ‘They are seeing a…’ line (as the *goto skips it).
Then it displays both Eye is 1 and Eye is 0 because I didn’t use an *if on the label bits as it isn’t needed for this test.

Can you try copy and pasting my above code into a blank file and seeing what happens.