*if question (SOLVED)


Right, so I’ve got a quick question.
In one scene, there are four roommate options. I did not create a specific scene for them all, but after one choice, your stat increases with your roommate.
So, my thought process is to create several *if statements, and if one of them is true, your respective roommate stat goes up (keep in mind, each roommate has their OWN stat column. It’s not just a “roommate” stat in the stats menu, it’s four different names.)

So, it might look like this… pretend I used the right spacing.

#Increase roommate stat option
Pretend this has correct spacing!
*if (roommate = “roommate1”)
*set roommate1 %+5
*if (roommate = “roommate2”)
*set roommate2 %+5

Etc etc etc, but with FOUR roommate options.

Would this work? Would I have to incorporate *else and *elseif , somehow? I would have, but since there are more than two/three options, I didn’t know if it was possible.

Thank you for reading my nonsense!

Here’s a quick solution:

*temp roommate ""
*temp John 1
*temp Ashley 1

Who is your roommate?

  *set roommate "John"
  *goto next
  *set roommate "Ashley"
  *goto next

*label next
Improve relationship (currently at 1)
  *set {roommate} +40

John = ${John}
Ashley = ${Ashley}

1 Like

You can use either. Generally, *elseif and *else are recommended because they’re less likely to be skipped in the event of a bug, but if you’re pretty clear on your code, you can do whatever. Also, you could help yourself greatly if you switched roommate to a numeric variable instead of a string.

    #Blah blah look at this choice.
        *if roommate = 1
            *set roommate1 %+5
        *elseif roommate = 2
            *set roommate2 %+5
        *elseif roommate = 3
            *set roommate3 %+5
        *elseif roommate = 4
            *set roommate4 %+5
            *bug Variable "roommate" below 1 or above 4, please report to forum thread.
        *goto nextchoice 
1 Like

Thank you tremendously! This helps a lot. I really appreciate it!!

Thank you so much! This really helps me out :slight_smile:

1 Like