CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

[Solved]How to auto-forward text in ren'py?

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,016
16,300
This is what happens when I type something on the forums I haven't tested beforehand.
To be fair, while the test isn't difficult by itself, it still need that you default some variables while creating them in an init block, then look what their value will be. All this while checking that you haven't forgot something that would invalidate the test.
It's New Year Eve, there's better things to do.


I knew default ran pretty late on during RenPy startup... after init:, but my assumption was that it checks to see if the variable already exists before assigning a value.
It check that the variable will not be assigned a default value twice, but I doubt that it effectively check if the variable exist ; it's more a variableName in defaultVariableStoringList test than a hasattr( store, variableName ) one. After all, the doc itself have example using both default and variables that exist for sure (preference/configuration/whatever) ; hell, even in option.rpy there's cases like that if my memory don't betray me.


Grrrr. Damn you Google, you failed me yet again.
... let's completely overlook that I didn't check the context of whole page when I found my initial answer.
Don't want to lower your mood, but you also missed the leading uppercase telling you that it's a class. But well, once again, it's New Year Eve, that your mind is wandering somewhere else it natural.
 
  • Haha
Reactions: 79flavors

Faithful

New Member
Dec 6, 2022
1
1
Necro'ing this thread because WOW using 79flavor's script (just dropped it into the /game folder) and used alt-pgup and could instantly use auto-forward in a game that didn't have it. Such a huge help!
 
  • Like
Reactions: 79flavors

mw2099

New Member
Mar 26, 2023
2
2
My 2 cents to the discussion on Auto-Forward Enable / Disable hotkey:
I noticed that quite a few vn's do not show the Preferences overlay on the screen - and since there is no hot-key attached to the Autoforward feature, I created a script that attached the autoforward toggle to the key: c
Next I bind the c key to one of my mouse buttons (and some more features, like back + fastforward, to other buttons) and now I can completely manipulate all features of renpy just using my mouse ;-)

Here's the script:
Python:
init python:
    def afm_overlay():
        ui.keymap(c=ui.callsinnewcontext("toggle_afm"))

    config.overlay_functions.append(afm_overlay)

label toggle_afm:
    #$ _preferences.afm_time = 12
    if _preferences.afm_enable:
        $ _preferences.afm_enable = False
    else:
        $ _preferences.afm_enable = True
    return

Just save as _toggle_c_autoforward.rpy (or something else) and copy into the "game" folder. I also always copy the 0x52_URM.rpa into it - which gives full control of all variables.

Happy VN'ing .. lol
 
  • Like
Reactions: Cuhullin

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,016
16,300
[...] and since there is no hot-key attached to the Autoforward feature,
You decided to open the renpy/common/00keymap.rpy file or, better, the " " page of the documentation or, even better, read the thread and precisely that post.

Then you understood that it suffice to have something like:
Python:
init python:
    config.keymap["toggle_afm"] = [ WHATEVER VALID KEY COMBINATION ]
to bind a hotkey to the Auto-forward feature.


Here's the script:
Why something so complicated, relying on long time outdated ui. function, that limits to basic keys, when in four lines you can have the same thing while benefiting from key combination, and ensuring that the code will still works in the future ?

Python:
init python:
    config.overlay_screens.append( "afmBinding" )

screen afmBinding():
    key "WHATEVER VALID KEY COMBINATION" action ToggleField( _preferences, "afm_enable" )
 
  • Like
Reactions: nonill3

nonill3

New Member
Oct 13, 2024
3
1
I just wanna say I hate when a game doesn't have the toggle to enable/disable auto-forward text and instead I have to waste time to include it myself.