Branching help - Endless loops

Hello everyone,

I’ve got issues with my coding below, I’l try to explain it :

Issue 1 :

On the first branching choice Railey-Greg-Ryan, when I decide to go first with Railey, it should be the loop
elif (RAILEY_TRUST_FIRST_CHOICE) under the label railey_trust that should be activated. But it doesn’t, it goes deirecetly to the loop if (APPROACH_GREG_FIRST_CHOICE_RAILEY_RYANBRANCH). It’s like my gain RAILEY_TRUST_FIRST_CHOICE is not remembered.

Issue 2 :

On the first branching choice Railey-Greg-Ryan, when I decide to go first with Greg, my elif doesn’t work. I mean the loop under label approach_greg that should be activated is elif (APPROACH_GREG_FIRST_CHOICE)

Instead it’s like the gain on the first choice is not remembered and it’s the loop if (RAILEY_TRUST_FIRST_CHOICE_GREGBRANCH) under the label approach_greg that is activated.

Can you help me on that ?

Thank you !


 SARA (talk_armscrossed_sad_loop)
I have to do something

choice
“Win back Railey’s trust” {
gain RAILEY_TRUST_FIRST_CHOICE
goto label railey_trust

} “Try to approach Greg” {

gain APPROACH_GREG_FIRST_CHOICE
goto label approach_greg

} “Go all in with Ryan” {

gain ALL_IN_WITH_RYAN_FIRST_CHOICE
goto label all_in_with_ryan

}

#############
label railey_trust

    SARA (talk_armscrossed_sad_loop)
She's completely mad at me
    SARA (talk_shrug_concerned)
With what Colin said, I don't even know what to do more

@SARA is deepbreath
@pause for 1.0

    SARA (talk_shrug_concerned)
Trying won't hurt

@SARA is text_phone_neutral_loop
sound phone_dialtone
@pause for 1.0
@SARA is listen_phone_sigh
sound phone_ring
@pause for 2.0
sound phone_ring
@pause for 2.0
sound phone_ring
@pause for 2.0
sound phone_record

@speechbubble is 164 288 to 94%
NARRATOR (RAILEY)
|italic, color:grey| Hi, you’ve reached Railey Lopez voice mail
|italic, color:grey| I’m unable to answer right now
|italic, color:grey| Leave me a message and I’ll contact you when I can

sound phone_record_off

@speechbubble is 127 286 to 94% with tail_top_right
SARA (talk_phone_sad_loop)
Railey it’s me Sarah
When you have a moment can you text me, or call me back
Please I beg you
I don’t want to loose you
@SARA is listen_phone_sigh
@pause for a beat

    SARA (idle_sad_loop)
(I guess we need time)

@pause for 1.0

if (APPROACH_GREG_FIRST_CHOICE_RAILEY_RYANBRANCH) {

@speechbubble is 131 287 to 94% with tail_top_right
SARA (talk_sad)
That leaves the last choice to Ryan

goto label all_in_with_ryan

} elif (RAILEY_TRUST_FIRST_CHOICE) {

    SARA (deepbreath)
(What now ?)

choice
“Try to approach Greg” {

gain RAILEY_TRUST_FIRST_CHOICE_GREGBRANCH
goto label approach_greg

} “Go all in with Ryan” {

goto label all_in_with_ryan

}

} elif (ALL_IN_WITH_RYAN_FIRST_CHOICE) {

}

##############
label approach_greg

    SARA (talk_sad_exhausted)
It's been so long
I don't know anymore what to apologise for

    SARA (talk_shrug_neutral)
Truth to be told, I don't know if I want to patch things up with him
    SARA (talk_shrug_concerned)
I don't even miss his absence

if (RAILEY_TRUST_FIRST_CHOICE_GREGBRANCH) {

    SARA (talk_sad)
(That leaves the last choice to Ryan)

@SARA is deepbreath

goto label all_in_with_ryan

} elif (APPROACH_GREG_FIRST_CHOICE) {

SARA (talk_sad_exhausted)
(What now ?)

choice
“Win back Railey’s trust” {

gain APPROACH_GREG_FIRST_CHOICE_RAILEY_RYANBRANCH
goto label railey_trust

} “Go all in with Ryan” {

goto label all_in_with_ryan

}

} elif (ALL_IN_WITH_RYAN_FIRST_CHOICE) {

}

##############
label all_in_with_ryan

if (RAILEY_TRUST_FIRST_CHOICE) {

@speechbubble is 131 287 to 94% with tail_top_right
SARA (talk_armscrossed_sad_loop)
Colin told me to give him space
I’m pretty sure I’m going to regret it
SARA (talk_sad_timid_loop)
I’m sorry for Railey and Greg as well
But I have to do all I can to make him come back to me

gain RAILEY_TRUST_FIRST_CHOICE_RYANBRANCH

@transition fade out black in 2.0
goto label NEXT_STAGE

} elif (APPROACH_GREG_FIRST_CHOICE) {

@speechbubble is 131 287 to 94% with tail_top_right
SARA (talk_armscrossed_sad_loop)
Colin told me to give him space
I’m pretty sure I’m going to regret it
SARA (talk_sad_timid_loop)
I’m sorry for Railey and Greg as well
But I have to do all I can to make him come back to me

gain APPROACH_GREG_FIRST_CHOICE_RYANBRANCH

@transition fade out black in 2.0
goto label NEXT_STAGE

} elif (ALL_IN_WITH_RYAN_FIRST_CHOICE) {

@speechbubble is 131 287 to 94% with tail_top_right
SARA (talk_armscrossed_sad_loop)
Colin told me to give him space
I’m pretty sure I’m going to regret it
But I can’t lose him
SARA (talk_sad_timid_loop)
I’m sorry for Railey and Greg
But I have to do all I can to make him come back to me

@transition fade out black in 2.0
goto label NEXT_STAGE

}

Long Explanation

Have you confirmed that this error occurs when the choice is active (check the flags using the debug tools)? Additionally, when replaying/testing, you may have actually gained the APPROACH_GREG_FIRST_CHOICE_RAILEY_RYANBRANCH flag. If this flag exists, then it should trigger that particular loop, as that is the behavior that it has been programmed to do. This will not be an issue for your readers as long as they cannot have both of those two flags.

Once again, if you have gained all of the flags, then this is the behavior that is expected from if statements. I have had difficulty reproducing these errors.

For clarity:
In an if-elif-else statement, there is a specific order of operations.
Say our setup is:

if (a) {*do action a*}
elif (b) {*do action b*}
else {*do action c*}

If a is true, only action a will be done (regardless of the value of b).
If b is true and a is false, action b will be done.
If neither a nor b is true, action c will be done.
(truth values for episode are whether or not a flag has been gained)

I don’t believe that there is currently an issue with the script, however it might be.
I suspect that you have some flags already selected when you are testing out your story, which is causing flags that should never occur together to both be gained. (The portal doesn’t clear things very usefully)
If this is not the case, then you should make sure to check where certain flags are being gained, in order to make sure that flags are not being given when they should not be.

Hi !

Actually there were a mistake in one of the gain, it was miswritten.
But you also were right, flags were already selected and weren’t cleared that’s why was looping over and over.

Thanks for your help !

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