How do I write an if-else script?


#1
 Apparently, I'm bad at writing scripts even when I get the templates out of the guide documents. So, I THINK I'm having an error where the using too many brackets, but I dont know which bracket to delete.

Here’s what I have.

NARRATOR
I dont know what to do. I dont want to be rude to this guy, but I dont want Julius to be mad at me.
Julius isn’t the jealous type, right?

choice (Ren01)
“Hear Ren out”{
VALKYRIE
I dont know what’s gotten into you, but you need to stop. This person has done nothing wrong. The least we can do is hear his request.

}“Just move along”{
VALKYRIE
Julius, please stop. Dont cause a scene.
The kids are still stressed about what happened.
Let’s just go.

}

if (Ren01 = “Hear Ren out”) {

    REN +1

} elif(Ren01 = “Just move along”) {
#The error happens above this line.

    REN -1

}


#2

I’m not good at this either, but have you tried:

} if (Ren01 = “Just move along”) {

Again, I’m not very good.


#3

I’m not good with it either, but maybe you should change the ‘elif’ to ‘else’? For example…

NARRATOR
I dont know what to do. I dont want to be rude to this guy, but I dont want Julius to be mad at me.
Julius isn’t the jealous type, right?

choice (Ren01)
“Hear Ren out”{
VALKYRIE
I dont know what’s gotten into you, but you need to stop. This person has done nothing wrong. The least we can do is hear his request.

}“Just move along”{
VALKYRIE
Julius, please stop. Dont cause a scene.
The kids are still stressed about what happened.
Let’s just go.

}

if (Ren01 = “Hear Ren out”) {

REN +1

} else {

REN -1

}

Hope this works! ^^


#4

Hi.
I’m afraid you’ve written up the reference wrongly. There shouldn’t be any =.

I’m going to reference you back to an old post of mine

In it I go over the three ways to remember choices and referencing back to them during the storyline. How you write them and their pros and cons.
Hopfully it helps you out.

<3


#5

Still nothing.


#6

Do you want to add points only in if/else?


#7

Sadly, I’m still getting the same error.


#8

Yes, but I’m not understanding why there’s a Block end / bracket error.


#9

Why complicate things? :thinking:

Just add
choice (Ren01)
“Hear Ren out”{
@REN +1
VALKYRIE
I dont know what’s gotten into you, but you need to stop. This person has done nothing wrong. The least we can do is hear his request.

}“Just move along”{
@REN -1
VALKYRIE
Julius, please stop. Dont cause a scene.
The kids are still stressed about what happened.
Let’s just go.

}


#10

Then later:

if (REN = 1){

}else{

}


#11

Apes suggestion sounds good - there’s no reason to make coding more complicated than it need to be. Sometimes you can take a few shortcuts

On the other hand, if you don’t find/solve the problem it may resuface another time. :thinking:

Make sure the error isn’t somewhere else in the script. The SE’s sensitive, but it also a bit shortsighted and sometimes the error isn’t what it says it is.
I suggest you put in a @pause for a beat before the REN +1/REN -1 and see what happens.

<3


#12

I complicate things, because I’m still learning how to use this thing. Thank you so much! lol


#13

Cheers to those who responded! Closing thread as it seems to have been resolved :slight_smile:


#14