Ren'Py In-game walkthrough help needed

jospaghettio

Member
Donor
Feb 13, 2019
450
1,565
Not sure if right section, but...

I've created a mod for Thirsty for my Guest. At the moment there are two versions. One with walkthrough and one without. I'd like to combine them by creating a togglable walkthrough.
screenshot0003.png
But I don't know how to connect the setting and the in-game choices.

Ideally, I'd like to keep it simple.

So, like setting up a kwarg for the choices.

Original:
menu:
"No problem {color=#00c000}(Recommended){/color}":

With kwarg "R"

menu:
"No problem"(R="Recommended"):

But I'm not a coder. Can someone create the code needed? I assume for screens.rpy.

Here's the screens.rpy 335 and 821 is what I've attempted. But when I changed the script to test, I got an error.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,561
15,520
Here's the screens.rpy 335 and 821 is what I've attempted. But when I changed the script to test, I got an error.
screens.rpy:335
Python:
default persistent.v_walkthrough_enabled = False
default persistent.v_walkthrough_disabled = True
Why two variables ???? It's either enabled, or it isn't, there's not reason to have both...


screens.rpy:821
Python:
            frame:
                has vbox:
                    xfill False
                label _("In-Game Walkthrough") xalign .5 yalign .9999 text_size 25 padding (10,10,10,10)
                if persistent.v_walkthrough_disabled:
                    textbutton _("Enable Feature") action Function(renpy.call_in_new_context, "enable_walkthrough") text_size 20 xalign .5 yalign .9999 padding (10,10,10,10)
                else:
                    textbutton _("Enabled") action SetField(persistent, "v_walkthrough_enabled", True) text_size 20 xalign .5 yalign .9999 padding (10,10,10,10)
                    textbutton _("Disabled") action SetField(persistent, "v_walkthrough_enabled", False) text_size 20 xalign .5 yalign .9999 padding (10,10,10,10)
label enable_walkthrough:
    $ persistent.v_walkthrough_enabled = True
    $ persistent.v_walkthrough_disabled = False

    return
return
Why using a label for one, and screen actions the others ?
And, obviously, once again why two variables ?


Python:
init python:
    persistent.v_walkthrough = False
[...]

screen preferences():
[...]
            frame:
                has vbox:
                    xfill False
                label _("In-Game Walkthrough") xalign .5 yalign .9999 text_size 25 padding (10,10,10,10)
                textbutton _( "{}".format( "Disable" if persistent.v_walkthrough else "Enable" ) ):
                    action ToggleField(persistent, "v_walkthrough" )
                    text_size 20 
                    xalign .5
                    yalign .9999
                    padding (10,10,10,10)

But when I changed the script to test, I got an error.
Bad for you, I guess... But if you want help about this part, saying what error you get seem to be a minimal requirement.
 

jospaghettio

Member
Donor
Feb 13, 2019
450
1,565
screens.rpy:335
Python:
default persistent.v_walkthrough_enabled = False
default persistent.v_walkthrough_disabled = True
Why two variables ???? It's either enabled, or it isn't, there's not reason to have both...


screens.rpy:821
Python:
            frame:
                has vbox:
                    xfill False
                label _("In-Game Walkthrough") xalign .5 yalign .9999 text_size 25 padding (10,10,10,10)
                if persistent.v_walkthrough_disabled:
                    textbutton _("Enable Feature") action Function(renpy.call_in_new_context, "enable_walkthrough") text_size 20 xalign .5 yalign .9999 padding (10,10,10,10)
                else:
                    textbutton _("Enabled") action SetField(persistent, "v_walkthrough_enabled", True) text_size 20 xalign .5 yalign .9999 padding (10,10,10,10)
                    textbutton _("Disabled") action SetField(persistent, "v_walkthrough_enabled", False) text_size 20 xalign .5 yalign .9999 padding (10,10,10,10)
label enable_walkthrough:
    $ persistent.v_walkthrough_enabled = True
    $ persistent.v_walkthrough_disabled = False

    return
return
Why using a label for one, and screen actions the others ?
And, obviously, once again why two variables ?


Python:
init python:
    persistent.v_walkthrough = False
[...]

screen preferences():
[...]
            frame:
                has vbox:
                    xfill False
                label _("In-Game Walkthrough") xalign .5 yalign .9999 text_size 25 padding (10,10,10,10)
                textbutton _( "{}".format( "Disable" if persistent.v_walkthrough else "Enable" ) ):
                    action ToggleField(persistent, "v_walkthrough" )
                    text_size 20
                    xalign .5
                    yalign .9999
                    padding (10,10,10,10)



Bad for you, I guess... But if you want help about this part, saying what error you get seem to be a minimal requirement.
I included a superfluous line because I don't know what I'm doing. I did say that I'm not a coder.

The error that I got after editing the script was:
Code:
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 113: expected ':' not found.
    "No problem"(R="Recommended"):
                ^

Ren'Py Version: Ren'Py 7.1.3.1092
Fri Aug 09 19:25:35 2024
I attempted to get the game to accept the "R" kwarg and show the hint when walkthrough enabled.

menu:
"No problem"(R="Recommended)":
$ vicki_like += 1

mc "You know I would do anything for you."
jump noproblem
"It's difficult":
mc "I'm really nervous about this. What if Jenna discovers I'm a still bad father?"
jump difficult


label noproblem:
v "That's so sweet, [player]. I hope you guys have fun!"
v "You'll love having her there in no time."
mc "Can't wait."
mc "I have to go get ready."
jump after_choices


label difficult:
v "You have plenty of time to prove the opposite if you want. Sorry about the inconvenience, [player]. I will repay you somehow."
mc "I doubt that. Anyway, I have to go now."


label after_choices:
mc "Talk to you later."
v "Be good, [player]."
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,353
4,129
jospaghettio

First up, congrats and well done for trying to contribute back to the game community. Everyone can do something, and even if you don't yet have coding skills, the effort of doing all the walkthrough hints is orthogonal to knowing or doing the programming work.

Some suggestions:

1. When posting code in the forum, *please* use code tags - it makes it much more readable and more importantly preserves the indentation that is vital for python/renpy code.

2. The choice menu is a renpy screen itself. and the code is editable.

So in your mod if you override the game's choice screen, you can add your own code. In this case, you could add code that refers to the global walkthrough flag and removes the hint information from the menu choices when the flag is false or unset.

There is a post somewhere in this DevHelp subforum that details how to override screens.
There are also posts (some by anne O'nymous ) that show how to make custom choice menu screens.

Hopefully that helps you make some progress. If you are still stuck then come back with questions.