Different choice paths?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Ashi-Yu
Newbie
Posts: 10
Joined: Mon Feb 29, 2016 9:02 pm
Projects: The New Light and Bittersweet
Tumblr: ashi-sky
Deviantart: BlueSky2795
Contact:

Different choice paths?

#1 Post by Ashi-Yu » Thu Mar 03, 2016 2:08 am

OK, so I made this two choice at the beginning of the game. The problem is, when I try the second choice the if flag doesn't work. I realize it's because the second choice just jumped over the flag, which is why the game couldn't identify it.

How do I skip the flag or do I do something else?
I feel like this is a pretty stupid thing to ask, but hey I'm a newbie.

User avatar
yuren
Newbie
Posts: 14
Joined: Sat Feb 20, 2016 2:41 am
Projects: chomp2
Github: yosephharyanto
Skype: yosephharyanto
Location: Indonesia
Contact:

Re: Different choice paths?

#2 Post by yuren » Thu Mar 03, 2016 2:37 am

Ashi-Yu wrote:OK, so I made this two choice at the beginning of the game. The problem is, when I try the second choice the if flag doesn't work. I realize it's because the second choice just jumped over the flag, which is why the game couldn't identify it.

How do I skip the flag or do I do something else?
I feel like this is a pretty stupid thing to ask, but hey I'm a newbie.
I guess providing with part of the code will help me understand your problem better. Can you post part of the code , especially at the choice menu and the flag part.

User avatar
Ashi-Yu
Newbie
Posts: 10
Joined: Mon Feb 29, 2016 9:02 pm
Projects: The New Light and Bittersweet
Tumblr: ashi-sky
Deviantart: BlueSky2795
Contact:

Re: Different choice paths?

#3 Post by Ashi-Yu » Thu Mar 03, 2016 10:17 am

yuren wrote:
Ashi-Yu wrote:OK, so I made this two choice at the beginning of the game. The problem is, when I try the second choice the if flag doesn't work. I realize it's because the second choice just jumped over the flag, which is why the game couldn't identify it.

How do I skip the flag or do I do something else?
I feel like this is a pretty stupid thing to ask, but hey I'm a newbie.
I guess providing with part of the code will help me understand your problem better. Can you post part of the code , especially at the choice menu and the flag part.

Code: Select all

  menu:
        "Just stay here.":
          jump choice1_stay
        
        "Try to find Lucy.":
          jump choice1_go
        
label choice1_stay: 
        
        n "Eh, I'll just stay here."
        
        jump waiting
        with fade
        
label choice1_go:
         
         show nick sassyface
         
         n "Waiting here would be pretty boring, anyway."
         
         scene black
         with dissolve
         
         "An hour later. . ."
         
         scene forest road(p_night)
         show nick oh no
         with fade
         
         n "I can't even tell which direction is right, which is left anymore."
         
         show nick surprised 
         
         m "Nick!"
         
         show nick shout
         
         n "Lucy?"
         
         show lucy concerned r at left
         show nick pokerface at right
         
         l "Where were you? I was worried!"
         
         show nick umm at right
         
         n "I was just wondering around."
         
         show lucy what r at left
         
         play music "If_I_Had_a_Chicken.mp3"
         
         l "To all the way up here?"
         
         show nick fluster at Position(xpos = 1.0, xanchor=0.80, ypos=1.0,
 yanchor=1.0)
         
         n "Um. Erm. Well."
         
         n "Who's that behind you, anyway?"
         
         show lucy shout r at left
         
         l "Don't change the subject!"
         
         show lucy frowny mad at Position(xpos = 0.25, xanchor=0.25, ypos=1.0,
 yanchor=1.0)
         show jeff smile c at Position(xpos = 0.00, xanchor=0.00, ypos=1.0,
 yanchor=1.0)
         
         j "Name's Jeff."
         
         show lucy smiler at Position(xpos = 0.25, xanchor=0.25, ypos=1.0,
 yanchor=1.0)
         
         l "Mr.Henderson helped me looked for you."
         
         show lucy frowny mad at Position(xpos = 0.25, xanchor=0.25, ypos=1.0,
 yanchor=1.0)
         show jeff snort c at Position(xpos = 0.00, xanchor=0.00, ypos=1.0,
 yanchor=1.0)
         
         l "Becuase you left me all by myself."
         
         n "I didn't mean it."
         
         l "Sure you didn't"
         
         l "Anyway, we should get home now."
         
         show jeff smile c at Position(xpos = 0.00, xanchor=0.00, ypos=1.0,
 yanchor=1.0)
         
         j "May I walk you guys home, then?"
         
         j "It's pretty late."
         
         show lucy smiler at Position(xpos = 0.25, xanchor=0.25, ypos=1.0,
 yanchor=1.0)
         
         l "Sure, Mr.Henderson."
         
         show nick uummmmm at Position(xpos = 1.0, xanchor=0.80, ypos=1.0,
 yanchor=1.0)
         
         n ". . ."
         
         jump home
I'm guessing when the second choice jump home, it skipped the flag. (which it did :? )
Then here's the flag:

Code: Select all

label choice1_sure:
    
    $ sure_flag = True
    
    show nick looking down blush
    
    n "Sure, I guess."
    
    jump lucy
    
label choice2_go:
    
    $ sure_flag = False
    
    show nick pokerface at right
    
    n "No thanks, but I'll be fine."

User avatar
panpanvw
Newbie
Posts: 3
Joined: Tue Mar 01, 2016 12:34 pm
Contact:

Re: Different choice paths?

#4 Post by panpanvw » Thu Mar 03, 2016 12:17 pm

I removed the text from your code ^^

Code: Select all

  menu:
        "Just stay here.":
          jump choice1_stay
        
        "Try to find Lucy.":
          jump choice1_go
        
label choice1_stay:     
        jump waiting
        with fade
        
label choice1_go:        
         jump home

label choice1_sure:
    $ sure_flag = True    
    jump lucy
    
label choice2_go:
    $ sure_flag = False
    
If I understand it correctly, your problem is that the flag isn't saved when you try the second option, so when you test for that flag later on it trows an error.
I can't see where labels "waiting" and "home" end up, so I don't know exactly where the problem lies.

It could be that it just skips this part entirely.

Code: Select all

label choice2_go:
    
    $ sure_flag = False
    
    show nick pokerface at right
    
    n "No thanks, but I'll be fine."
If so, your code never reached the flag. Try inserting a "jump choice2_go" statement somewhere appropriate.

Is there a second menu before you reach the flag?
If there isn't you could also place the flag in the menu (before the jump statement), to be sure the flag is saved.
(Overall I find it a nice idea to save the flag after the choice that determines the flag instead of in between a lot of text.)

If that doesn't help, it might be a good idea to post the error message (if there is any) or a bit more of your code (so we can see where the labels "home" and "waiting" end up).

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Different choice paths?

#5 Post by gas » Thu Mar 03, 2016 4:22 pm

Very easy. Define the flag at the start of the game.

Code: Select all

label start:
    $ mychoice=False
    e "An example"
The flag will always be False until you change it to a different value.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
Ashi-Yu
Newbie
Posts: 10
Joined: Mon Feb 29, 2016 9:02 pm
Projects: The New Light and Bittersweet
Tumblr: ashi-sky
Deviantart: BlueSky2795
Contact:

Re: Different choice paths?

#6 Post by Ashi-Yu » Thu Mar 03, 2016 9:07 pm

panpanvw wrote:I removed the text from your code ^^

Code: Select all

  menu:
        "Just stay here.":
          jump choice1_stay
        
        "Try to find Lucy.":
          jump choice1_go
        
label choice1_stay:     
        jump waiting
        with fade
        
label choice1_go:        
         jump home

label choice1_sure:
    $ sure_flag = True    
    jump lucy
    
label choice2_go:
    $ sure_flag = False
    
If I understand it correctly, your problem is that the flag isn't saved when you try the second option, so when you test for that flag later on it trows an error.
I can't see where labels "waiting" and "home" end up, so I don't know exactly where the problem lies.

It could be that it just skips this part entirely.

Code: Select all

label choice2_go:
    
    $ sure_flag = False
    
    show nick pokerface at right
    
    n "No thanks, but I'll be fine."
If so, your code never reached the flag. Try inserting a "jump choice2_go" statement somewhere appropriate.

Is there a second menu before you reach the flag?
If there isn't you could also place the flag in the menu (before the jump statement), to be sure the flag is saved.
(Overall I find it a nice idea to save the flag after the choice that determines the flag instead of in between a lot of text.)

If that doesn't help, it might be a good idea to post the error message (if there is any) or a bit more of your code (so we can see where the labels "home" and "waiting" end up).
Yeah, there's a second menu before the flag, and I think it is because it just skips this part entirely. I'n not sure where to insert the statement, though. ;;w;;

User avatar
yuren
Newbie
Posts: 14
Joined: Sat Feb 20, 2016 2:41 am
Projects: chomp2
Github: yosephharyanto
Skype: yosephharyanto
Location: Indonesia
Contact:

Re: Different choice paths?

#7 Post by yuren » Thu Mar 03, 2016 11:44 pm

gas wrote:Very easy. Define the flag at the start of the game.

Code: Select all

label start:
    $ mychoice=False
    e "An example"
The flag will always be False until you change it to a different value.
+ 1. Rather than thinking on where to put the flag, just put a default flag value at start of the game.. and change it when necessary. Doing this will simplify your flow..

User avatar
Ashi-Yu
Newbie
Posts: 10
Joined: Mon Feb 29, 2016 9:02 pm
Projects: The New Light and Bittersweet
Tumblr: ashi-sky
Deviantart: BlueSky2795
Contact:

Re: Different choice paths?

#8 Post by Ashi-Yu » Fri Mar 04, 2016 11:48 pm

yuren wrote:
gas wrote:Very easy. Define the flag at the start of the game.

Code: Select all

label start:
    $ mychoice=False
    e "An example"
The flag will always be False until you change it to a different value.
+ 1. Rather than thinking on where to put the flag, just put a default flag value at start of the game.. and change it when necessary. Doing this will simplify your flow..
Oh awesome! It worked, thanks!!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]