Not showing text when using an "if"

Hey everyone!

So I’m trying to use an if to reference a past choice, but when I use the if statement, the text underneath it doesn’t show up. I’m not getting any error messages so I can’t figure out why it won’t show up.

Show us your code? Then we can give you specific advice.

Maybe you didn’t indent the text below the if statement like that:

*if blah = "something"
  TEXT HERE
  *goto whatever label you want

I believe it’s more like there’s a change in the text that blocks the *if from passing. Otherwise, there’d be an error message or the text inside would always shows up.

I had something similar happen when I wrote a lot of text and choices under it that also had a few ifs. While there were a few that didn t have an if, it still didnt show. My solution was to just go to another label.

*if (blah)
   *goto you_dun_goofed 

*label you_dun_goofed 
Text
*choice
  #choices
   *goto some
1 Like

Obvious question, but are you sure your if-condition is true?

2 Likes

*choice
#Blah blah
*temp var “Dress1”
Blah blah
*goto Next
#Blah blah
*temp var “Dress2”
Blah blah
*goto Next

*label Next

*if (“Dress1” = 0)
Blah blah
*if (“Dress2” = 100)
Blah blah

If I’m being honest I’m still having a hard time wrapping my head around variables and if’s, so please let me know any input you have. I really appreciate it!

This is gonna sound dumb but I think so? I’m still in the process of teaching myself so any input on what I’m doing or not doing would be appreciated!!

To declare a variable:

*temp variable_name variable_content

or

*create variable_name variable_content

So if you wish to create a variable, you first place the name of the variable and then what data it should have.

The way it is now, with:

*temp var "Dress1"
.
.
.
*temp var "Dress2"

You are creating a variable with the name ‘var’ and its content is the following text: “Dress1”. On the second *temp you are creating it again (thus replacing the older value of ‘var’) as ‘var’ again but with the value “Dress2”.

Let’s suppose you wanted to hold their colors instead, for easier explaining purposes. Say you want two variables called ‘Dress1’ and ‘Dress2’ that hold their colors, you would do it like this:

*temp Dress1 "blue"
*temp Dress2 "red"

Now you made two variables called ‘Dress1’ and ‘Dress2’. To display these variables in the game you use ${variable_name}. As in:

The color of my dress is ${Dress1}!

In the game this will appear:

The color of my dress is blue!

Another important thing is the data type they hold. Anything between " " are text variables. Numbers don’t have quotes between them.

*temp total_price 85

So your ‘total_price’ variable is 85. Make sure to not declare it as “85” or there could be issues if you want to sum, subtract or do other things with the variable.

To refer to the variable inside an *if command you just use the variable name without quotes.

*if (total_price > 80)
     The price is too high! It's over $80!

In the *if you posted, you would not be referring to a variable called ‘Dress1’ but instead just a text with the content “Dress1” and if it equals 0 or 100, it’s not gonna work.

*if (Dress1 = "green")
   Your dress is green!
*else
   Your dress is not green!

This would display Your dress is not green! because the value of the ‘Dress1’ variable we created is “blue”, not “green”. Make sure to always use the proper variable types so conditions work correctly.

2 Likes

Your conditional checks are incompatible with the declaration-choice: *temp var "DressX =/= *if DressX = XX.

Declaration works like this

*create [variable] [content]
*temp [variable] [content]   ///both *create and *temp isn't relevant here; I assume you know the diff between the two

While conditional checks work in this format

*if [variable] = [content]
   text
*elseif [variable] = [content2]
   text
*else
   text
1 Like

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