[Solved] Story/chapter selection - Very confused please help

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.
Message
Author
User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: [Solved] Story/chapter selection - Very confused please

#16 Post by Ocelot »

Mostly it is because you are still in menu context, renpy thinks that you are still in main menu and might behave accordingly. I have run into strange issues, like one branch repeating twice when selected (and second run did not reinicialize variables, so I was left in broken state), inability to open game menu screen, crashes when loading in specific places. (I do not know how much is caused by not starting game properly, and how much was caused by jumping from call screen statement: it can cause problems too)

On the other hand it worked seamlessly in some cases. I do not know what happens behind the scenes, but I would be really careful with that.
< < insert Rick Cook quote here > >

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: [Solved] Story/chapter selection - Very confused please

#17 Post by Ocelot »

I personally would set a flag, showing what screen you want to display in main menu:

Code: Select all

define persistent.show_ch_select = False # Not nessesary, actually

label splascreen:
    # We want each launch start with actual main menu
    $ persistent.show_ch_select = False 
    return

# Obviously, you need to actually make it reachable from main_menu screen too
screen chapter_select():
    tag menu # for interoperability with other menus
    use navigation # For all kinds of pretty buttons
    vbox:
        textbutton '---ch1---':
            # Before starting new chapter, we set marker telling that we need to return to the chapter selection screen
            action [SetField(persistent, 'ch_select', True), Start('ch1')] 
            # Clearing selected state
            selected False
        textbutton '---ch2---' action [SetField(persistent, 'ch_select', True), Start('ch2')] selected False

label main_menu:
    # Check if we need to display chapter select screen.
    if persistent.show_ch_select:
        $ persistent.show_ch_select = False 
        call screen chapter_select
    else:
        call screen main_menu
    return

label ch1:
    'chapter 1'
    return
label ch2:
    'chapter 2'
    return
< < insert Rick Cook quote here > >

User avatar
SethRiley
Regular
Posts: 35
Joined: Sat Mar 18, 2017 3:27 pm
Contact:

Re: [Solved] Story/chapter selection - Very confused please

#18 Post by SethRiley »

Ocelot, that indeed seems like a way more legit approach.

Circumventing the internal programmings of RenPy by pulling tricks causes problems. The first problem I run into is the title music. Since the title screen is triggered with a call statement within the splash screen the music doesn't play the first time you visit the title screen; it does play the second time around. There are ways to fix this, but they're fixes to problems that shouldn't exist in the first place.

I am implementing your method as we speak Ocelot. I shall post how the results differ.

User avatar
SethRiley
Regular
Posts: 35
Joined: Sat Mar 18, 2017 3:27 pm
Contact:

Re: [Solved] Story/chapter selection - Very confused please

#19 Post by SethRiley »

I followed your method to the letter Ocelot, and the application now largely functions in a correct manner.

However, the user ends up back at the title screen (main_menu) again after each story.

I've tried flipping False to True and switching around the screens, which leads me to believe this bit of code here seems to work fine:

Code: Select all

label main_menu:
    
    if persistent.show_ch_select:
        $ persistent.show_ch_select = False 
        call screen chapter
    else:
        call screen main_menu
    return
I wonder where it exactly goes wrong. "define persistent.show_ch_select = False" is present in the script. The screen actions are written as follows:

Code: Select all

imagebutton idle "gui/chapter_button.png" xpos 24 ypos 24 action [SetField(persistent, 'ch_select', True), Start('ch1')] selected False
Trying to figure it out as we speak.

Thanks for your help and valuable insights Ocelot.

User avatar
SethRiley
Regular
Posts: 35
Joined: Sat Mar 18, 2017 3:27 pm
Contact:

Re: [Solved] Story/chapter selection - Very confused please

#20 Post by SethRiley »

Got it! :D

What finally works is:

Code: Select all

define persistent.show_ch_select = True

label splashscreen:
    
    $ persistent.show_ch_select = True 
    scene white
    with Pause(0.5)
    show splash at Position(xpos = 0.5, xanchor=0.5, ypos=0.5, yanchor=0.5) with dissolve
    with Pause(2.5)
    scene white with dissolve
    with Pause(1)
    return

label main_menu:
    
    if persistent.show_ch_select:
        $ persistent.show_ch_select = False 
        call screen main_menu
    else:
        call screen chapter
    return
Some of what was False had to be True :-p
Last edited by SethRiley on Sun Mar 19, 2017 9:32 pm, edited 1 time in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: [Solved] Story/chapter selection - Very confused please

#21 Post by Imperf3kt »

Won't that lable name will cause headaches? Since it will conflict with renpy internal files.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
SethRiley
Regular
Posts: 35
Joined: Sat Mar 18, 2017 3:27 pm
Contact:

Re: [Solved] Story/chapter selection - Very confused please

#22 Post by SethRiley »

Hi Imperf3kt. What label name exactly? ch1?

Ravenheart
Newbie
Posts: 5
Joined: Thu Sep 06, 2018 7:52 am
Contact:

Have a selection screen without jumping

#23 Post by Ravenheart »

Hi Guys...

I have the exact same question here as this thread started on.. the only diff to my question is this..

Instead of going to the story that was chosen in the "chapter screen" and reading the story to then later return to this screen to choose a different story.. instead of this i would like to have a "chapter screen" aswell with many different storys but the player should be able to "pre-select" all the stories he is interested in reading and then without renpy jumping to the first one there should be a button that says something like start here.. renpy then starts the first choice and cycles through to the next choice chosen and finaly when all the stories that were chosen at this first screen then only the game ends?

This is a huge roadblock for me i really hope this would be possible maybe with some python code?

Please please please tell me it is possible!!

Ravenheart
Newbie
Posts: 5
Joined: Thu Sep 06, 2018 7:52 am
Contact:

Re: [Solved] Story/chapter selection - Very confused please help

#24 Post by Ravenheart »

Sorry i saw this is a duplicate
Last edited by Ravenheart on Tue Sep 11, 2018 8:57 am, edited 1 time in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: [Solved] Story/chapter selection - Very confused please help

#25 Post by Imperf3kt »

You can do that, I beleive.

I haven't got the time to try an example right now, but I assume you can use lists and variables to determine what label to jump to.

Perhaps someone more skilled than myself already has such a thing or can easily make one?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Ravenheart
Newbie
Posts: 5
Joined: Thu Sep 06, 2018 7:52 am
Contact:

Re: [Solved] Story/chapter selection - Very confused please help

#26 Post by Ravenheart »

Imperf3kt wrote: Tue Sep 11, 2018 6:13 am You can do that, I beleive.

I haven't got the time to try an example right now, but I assume you can use lists and variables to determine what label to jump to.

Perhaps someone more skilled than myself already has such a thing or can easily make one?
Hi there☺

Thanks for the quick response!

I would so much appreciate any help or direction and hopefully if you can when you have some time show me an example perhaps i will jump with joy on the inside!!!!!

Regards

Post Reply

Who is online

Users browsing this forum: No registered users