Help with if command

Hi,

I’m really new to this//coding in general, but this is driving me up the wall.

Is it possible to use if/else choices to create alternate display texts? I thought it was, but whenever I try it just skips to the first “if” option regardless of what the stats are.

I’ve been trying to set it so that if you have a high enough stat in one category, you’ll get alternate scenes.

I think it might have something to do with the way my stats are set up, but I’m not sure. It’s a percentage stat, so I don’t know if I can do the (*create example true) variable that I’ve been seeing.


Currently my coding is:

*if Wilder_romance >15
Wilder clears ${pronoun2} throat nervously

“Well, um…” A small smile curls at the corner of my mouth. It’s very rare to see Wilder genuinely flustered, and I always appreciate the sight.

“Would you like to dance,” I ask {pronoun3}, reaching out a hand for him to take. If I'm not mistaken, I think I see the tips of Wilder's ears turn red. !{pronoun} runs a hand through ${pronoun2} hair nervously.

Accepting my extended hand, Wilder delicately puts {pronoun2} right hand in my left, and places {pronoun2} other hand on my waist.
*goto Boom

*else
Wilder clears ${pronoun2} throat, slightly uncomfortable.

“Well, ${title}. Has anyone caught your eye yet?”

I smile at the teasing tone in Wilder’s voice. It’s pleasant to hear someone talk to me so casually after an evening full of rigid formality.
*goto Boom


If anyone can help, I would appreciate it. I have the first chapter almost finished, but mentally I can’t move on until I get this solved.

2 Likes

If you use the </> button, just above where you are typing here, you can format your code so we can see if you are indenting properly.

When you create a numerical variable, it must be created as a numerical variable like this:

*create example 0

rather than

*create example true

Also, as a side note–careful not to do “{pronoun3}” but instead do ${pronoun3}–I saw a few of those in your code above.

1 Like

Thank you!!!

1 Like

You’re missing your parentheses and a couple of spaces are off should be most of the issue:

*if (Wilder_romance > 15)
 Wilder clears ${pronoun2} throat nervously

 “Well, um…” A small smile curls at the corner of my mouth. It’s very rare to see Wilder genuinely flustered, and I always appreciate the sight.

 “Would you like to dance,” I ask ${pronoun3}, reaching out a hand for him to take. If I'm not mistaken, I think I see the tips of Wilder's ears turn red. $!{pronoun} runs a hand through ${pronoun2} hair nervously.

 Accepting my extended hand, Wilder delicately puts ${pronoun2} right hand in my left, and places ${pronoun2} other hand on my waist.
*goto Boom

*else
 Wilder clears ${pronoun2} throat, slightly uncomfortable.

 “Well, ${title}. Has anyone caught your eye yet?”

 I smile at the teasing tone in Wilder’s voice. It’s pleasant to hear someone talk to me so casually after an evening full of rigid formality.
*goto Boom
3 Likes

You don’t actually need those parentheses.

*if Wilder_romance > 15

works totally fine. It’s not a terrible habit to get in, and you will need them when you get into testing multiple variables, but for one variable, you don’t need them.

2 Likes

I think this should be ${pronoun2}

1 Like

Whoops. Yeah I have a lot of little things like that I need to clean up, I started writing the plot before I began working on the code,

Thank you so much!!! This fixed it!

1 Like
*if (Wilder_romance > 15)
  Wilder clears ${pronoun2} throat nervously

  “Well, um…” A small smile curls at the corner of my mouth. It’s very rare to see Wilder genuinely flustered, and I always appreciate the sight.

  “Would you like to dance,” I ask ${pronoun3}, reaching out a hand for him to take. If I'm not mistaken, I think I see the tips of Wilder's ears turn red. $!{pronoun} runs a hand through ${pronoun2} hair nervously.

  Accepting my extended hand, Wilder delicately puts ${pronoun2} right hand in my left, and places ${pronoun2} other hand on my waist.
  
  *goto Boom

*else
  Wilder clears ${pronoun2} throat, slightly uncomfortable.

  “Well, ${title}. Has anyone caught your eye yet?”

  I smile at the teasing tone in Wilder’s voice. It’s pleasant to hear someone talk to me so casually after an evening full of rigid formality.

  *goto Boom

Fixing a couple indents in this example. You’ll get a “can’t fall out of if/else statement” error otherwise.

By the way I really like your style of writing from the example here!

Thank you! I’m really enjoying this project, I hope I keep working on it.

1 Like