Ren'Py Is there a way to toggle auto-forward?

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,862
16,003
please edit this file for me . I will see what I was missing thnx....
It's just text edition. You really don't need someone else to do this. You're able to write a comment to ask for help, and even to attach a file to this comment ; therefore you're totally able to correct this by yourself :
  1. Found the line where there's
    Code:
        gui.init(1920, 1080) define -2 gui.config.keymap['toggle_afm'].append("f")
    (it's the line 12) ;
  2. Put the cursor right before define ;
  3. Press the ENTER key to make them two lines instead of one ;
  4. Save the file.
 

drKlauz

Newbie
Jul 5, 2018
40
24
I mean why not just put patch.rpy with
Code:
init python:
  config.keymap['toggle_afm'].append("f")
in GameName/game folder.
Anon solution from 14 April is best option i believe.
 
  • Like
Reactions: kyubi95

abhi1180

Active Member
Sep 12, 2018
525
419
It's just text edition. You really don't need someone else to do this. You're able to write a comment to ask for help, and even to attach a file to this comment ; therefore you're totally able to correct this by yourself :
  1. Found the line where there's
    Code:
        gui.init(1920, 1080) define -2 gui.config.keymap['toggle_afm'].append("f")
    (it's the line 12) ;
  2. Put the cursor right before define ;
  3. Press the ENTER key to make them two lines instead of one ;
  4. Save the file.
thnx for your help...
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,254
Why do you want to unrpa/unrpyc/edit gui at all? Just put rpy patch in game directory, game should pick it up automatically. Or am i missing something?
Nope, you're not missing anything.

Just a habit I got into. So when I write stuff... I tend to repeat the steps I took rather than rethinking it.
In my case... I tend to always unpack every RenPy game I get before I play it all the way to the source RPY files.
Since gui.rpy tends to always be there and because I know it works there... that's where I add that line of code.
Also since the command I'm using affects gui.config.keymap, gui.rpy seemed like the right place.

On top of that, there's still aspects of RenPy/Python that I don't understand/trust. In this case, init python level numbers. I'm never sure what happens if you end up with two level numbers at the same level in different files... so writing a "one-size-fits-all" solution as a separate file was an unknown for me... -vs- a solution I knew worked.
So I took the path of least resistance and write out the instructions that worked for me.
 
Last edited:

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,254
please edit this file for me . I will see what I was missing thnx....
I think you already got this working with anne O'nymous's help... but yeah.. somehow you'd ended up copying a few things you didn't need and merging two lines together that should have been separated.

But in case I'm mistaken... here's an updated file for you.
 
  • Like
Reactions: Cuhullin

BeastMaster59

Well-Known Member
Jun 12, 2017
1,432
4,925
Or you can do it without the need to edit a file :
[myShortcut.rpy]
Python:
init python:
    config.overlay_screens.append( "myQM" )

style mQMtb is empty:
    bottom_margin 10
    hover_bottom_margin 0

style mQMtb_text is empty:
    bold True
    color "#FFF"
    size 15
    hover_size 25
    outlines [ ( 1, "#000", 0, 0 ) ]

screen myQM:
    zorder 1000

    drag:
        drag_offscreen False
        yalign 1.0
        xalign 0.0
        drag_handle (0, 0, 1.0, 1.0)

        frame style "default":
            xsize 50
            vbox:
                textbutton "Back" style "mQMtb" action Rollback()
                null height 5
                textbutton "Auto" style "mQMtb" action Preference("auto-forward", "toggle")
                null height 5
                if config.console is True:
                    textbutton "Console" style "mQMtb" action Function( store._console.enter )
It's a dirty code, but it works fine and it's transparent for Ren'py ; as long as the game don't mess with the overlays.
works great ...Thanks
 

JayCihns

New Member
Feb 15, 2020
10
36
Or you can do it without the need to edit a file :
[myShortcut.rpy]
Python:
init python:
    config.overlay_screens.append( "myQM" )

style mQMtb is empty:
    bottom_margin 10
    hover_bottom_margin 0

style mQMtb_text is empty:
    bold True
    color "#FFF"
    size 15
    hover_size 25
    outlines [ ( 1, "#000", 0, 0 ) ]

screen myQM:
    zorder 1000

    drag:
        drag_offscreen False
        yalign 1.0
        xalign 0.0
        drag_handle (0, 0, 1.0, 1.0)

        frame style "default":
            xsize 50
            vbox:
                textbutton "Back" style "mQMtb" action Rollback()
                null height 5
                textbutton "Auto" style "mQMtb" action Preference("auto-forward", "toggle")
                null height 5
                if config.console is True:
                    textbutton "Console" style "mQMtb" action Function( store._console.enter )
It's a dirty code, but it works fine and it's transparent for Ren'py ; as long as the game don't mess with the overlays.

Thanks for the post on this. It was very helpful. Just started a new game though the dev didn't implement any Quick Menu toggles. Nor any way to toggle the Auto-Forward feature. I tweaked your script a bit to enable the most common toggles.

QM_screenshot_rh.jpg script.thumb.jpg

Zip file has 2 scripts where you can place the toggles on the left or RH side depending on your preference. Still working on how to format the toggles for the bottom of the screen.

I used this site to personalize the font HEX color values of my particular game. Of course there are plenty of sources with a google search.

Any toggles not needed just remove them or place "##" in front of them so they will be ignored.

Auto-Fwd key-map set to Alt + UP arrow. Unlikely to conflict with anything else but set whatever key you want.

Alt download link:
 
Last edited:
  • Like
Reactions: Cuhullin

Lathan321

Member
May 24, 2017
362
145
In my case, I got fed up of playing games that didn't include an "auto" button, or had disabled the whole shortcuts bar.

My solution was to add config.keymap['toggle_afm'].append("alt_K_PAGEUP") to the gui.rpy file.

Edit: Added an override .rpy file which adds this automatically (as well as setting the default sound volumes, default text speed, switching on the dev console and developer modes and defaulting games to full screen.) My override file is attached and works with most games without having to edit the original. Obviously you may not like my preferred text speed or full screen or something... in which case, just remove those lines.

Most* games have a gui.rpy file that starts like:
Python:
init python:
    gui.init(1920, 1080)
*Works 99% of the time. I think I've come across ONE game where it didn't work for some reason and one other game that had removed the gui.rpy file completely.

I change it to:
Python:
init python:
    gui.init(1920, 1080)
    config.keymap['toggle_afm'].append("alt_K_PAGEUP")
In my case, I'm using ALT+PAGEUP as my toggle keys. And doing it this way means I don't need to worry about whether the quick-menu bar is shown or not. I just press my key and it toggles auto-forward on or off.

You might have to use UnRen to get access to the gui.rpy file, so you can edit it.
I'm sure @recreation 's solution works too.
How would I go about adding quick save and load to this?
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,254
How would I go about adding quick save and load to this?

Sounds like you'd want:

Python:
init python:
    config.keymap["quick_save"] = ["K_F5"]
    config.keymap["quick_load"] = ["K_F9"]

My original code has .append(), because toggle_afm already has a keybind.

It's also usually worth checking the - to make sure that RenPy isn't using the key already. (Like F5/F9).
 
  • Like
Reactions: Lathan321

Lathan321

Member
May 24, 2017
362
145
Sounds like you'd want:

Python:
init python:
    config.keymap["quick_save"] = ["K_F5"]
    config.keymap["quick_load"] = ["K_F9"]

My original code has .append(), because toggle_afm already has a keybind.

It's also usually worth checking the - to make sure that RenPy isn't using the key already. (Like F5/F9).
Doesnt seem to be working, but not a huge deal. The auto forward is enough. That's the more annoying thing overall. lol Thanks for the original file nonetheless!