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

Jon_Maker

New Member
Aug 3, 2018
10
5
Currently, I am using the below script to auto-forward every sentence said by the characters
define t = Character("[name]", what_suffix='{w=2}{nw}')

Is there a better way to do this or will have I have to keep using the what_suffix argument for every define character statement?
 

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,909
6,631
Auto-forward shouldn't be forced on and most certainly not "hard-wired" into the script, IMHO.
Auto-forward can be toggled by the player from the quick menu "Auto" button and it should be his choice to switch it.
It's better not to force-disable or enable things that are set in Ren'Py by default.

Please, do not code it into your script. Players won't like it and one of them will provide a patch to others to override it, anyway. You will just "lose a point" there to the person who provides that patch.

Why do you want to auto-forward text, anyway?

Just so you'd know - only some players like it and use it, a whole lot of them don't use it and some hate it. For example, I find it most annoying, I never use it and when I find it being forced on, I just disable it any way I can.
 
  • Like
Reactions: anne O'nymous

Jon_Maker

New Member
Aug 3, 2018
10
5
Thank you for your response.

And yeah you are right about the fact that I shouldn't force the reader to auto-forward. Still, I want to give the user the choice if they want to auto-forward. But instead of using the "auto" button in the quick menu, is there a way to create a toggle like for eg,
pressing the "a" key on the keyboard lets you auto-forward and if it's pressed again it stops.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,236
14,997
Players won't like it [...]
I'll even say that they'll be pissed by it. Between those who
  • Answer the phone and, going back to the game, discover that they are now three days forward in the story ;
  • Are sight impaired (with or without the help of a vocal reader) ;
  • Aren't native English reader and need way more time to understand what's wrote ;
  • Are colorblind and struggle to read the text because the color association isn't right for them ;
  • Have dyslexia and willl struggle because the font isn't great ;
  • Play late at night and are already half asleep ;
  • Are a little drunk or high when they play.
And so many other, yeah, many people will be pissed if the game force by itself the auto-forward and its speed.


Still, I want to give the user the choice if they want to auto-forward.
Why ? Honestly it feel like you're saying : "I know that my car already have a motor, but is there a way to add some pedals system to make it advance ?"


But instead of using the "auto" button in the quick menu, is there a way to create a toggle like for eg, pressing the "a" key on the keyboard lets you auto-forward and if it's pressed again it stops.
If it's because you want to get ride of the quick menu, just edit the said quick menu's screen, remove what you don't want and style it like you want. Else, see what I said above and what Penfold Mole said.
 

Jon_Maker

New Member
Aug 3, 2018
10
5
First of all, thank you for your detailed response.

I'll even say that they'll be pissed by it. Between those who
  • Answer the phone and, going back to the game, discover that they are now three days forward in the story ;
  • Are sight impaired (with or without the help of a vocal reader) ;
  • Aren't native English reader and need way more time to understand what's wrote ;
  • Are colorblind and struggle to read the text because the color association isn't right for them ;
  • Have dyslexia and willl struggle because the font isn't great ;
  • Play late at night and are already half asleep ;
  • Are a little drunk or high when they play.
You raise some very good points here.

And so many other, yeah, many people will be pissed if the game force by itself the auto-forward and its speed.
Yeah, that's why I intend it to be optional. By default, it will be disabled. And even if it's enabled, readers can change the speed of text and delay time in the preferences tab.

Why ? Honestly it feel like you're saying : "I know that my car already have a motor, but is there a way to add some pedals system to make it advance ?"
Mostly because my VN is going to be pretty text heavy and recently I came across a japanese VN (which was also pretty text heavy) where there was such a toggle in the options menu which personally for me, made the reading a whole lot easier. But again, by default auto-forward will be disabled.

As for the solution I somehow managed to find it. I used the following code
key "a" action Preference("auto-forward", "toggle") #Auto-forward text
in the say screen and I added the toggle in the preferences tab as well.

Code for the preferences tab:
vbox:
style_prefix "radio"
label _("Auto-Forward Text")
textbutton _("Enable") action Preference("auto-forward", "toggle")
 
  • Like
Reactions: Elementario

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,561
2,181
Necro'ing this post, since someone mentioned it and maybe someone will search and find this post.

My solution for toggling auto-forward evolved over time. Eventually I ended up with a custom script file that I just put in the /game/ folder of each new RenPy game I'm about to start playing. It sets up a key I can toggle "auto-forward" on and off (ALT + PGUP), even if the original game hides the standard quickbar, etc. So to the OP... Yes, you can bind it to to a key and an example is included as part of the script I'm attaching.

My script also sets the defaults for things I like (such as starting in Fullscreen, specific sound/music volumes and specific text speeds and auto-advance timer).

As long as I put the script file there before I start the game for the first time, it picks up the defaults *I WANT* rather than the standard system ones. But without changing any values that would affect a game already in progress (except the keybind).

The keybind works on 99% of games... but there are exceptions. Just count those as the developer being too clever for their own good.

Anyway, if anyone wants to try it... I'm attaching my current version here.
(feel free to delete any default overrides you personally don't like or change them to values you do).
The name of the file can be anything. I just picked one that I knew wouldn't conflict with any game now or in the future.
 

bodyharvest

Member
Feb 26, 2018
242
328
Necro'ing this post, since someone mentioned it and maybe someone will search and find this post.

My solution for toggling auto-forward evolved over time...
You, my good sir, are a hero! Tank you for this. I was searching for something like this for a long time.

I always use(d) the open console > quick_menu = True with Unren way. But with more and more games that doesn't work anymore. :( (n) :mad:
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,561
2,181

bodyharvest

Member
Feb 26, 2018
242
328
Unren 0.8 doesn't always work with the latest release(s) of RenPy... BUT...

There is development build of 0.9 that works just fine (or at least, I haven't found something that hasn't work yet).
https://f95zone.to/threads/unren-ba...compiler-console-developer-menu-enabler.3083/

Just take a look at the 2nd attachment in that thread.
Hi 79flavors, I tried 0.9 on "Sugar Daddies"and "Indecent Desires" but didn't work.

I tried "quick_menu = True/False" (tried both). I tried "main_menu = True/False"
I even tried "suppress_overlay = True/False" (have no idea what this does, found it in the Variable viewer.)
But unfortunately nothing.

But your flavor code does work!
 

Entai2965

Newbie
Jan 12, 2020
96
297
In addition to the above two ways to enable here are two more:

#3
in "renpy-sdk\renpy\common\00keymap.rpy", find the line that says:
Code:
toggle_afm = [ '' ],
and change it to:
Code:
toggle_afm = [ 'q' ],
to assign a keyboard shortcut. The function exists but there is no shortcut to it by default. Remember to update the Help/Controls page to let users know there is a shortcut to toggle it on/off now.

#4
To enable it inside of a script do:
Code:
$ preferences.afm_enable = True
The auto forward time can be changed using
Code:
preferences.afm_time
, so to pop up a temporary screen, the full code could be something like...

Code:
label start:

#dialogue
[...]

call tempStatus()

#more dialogue
[...]

return()

####################################

label tempStatus():

#save user settings
$ oldAutoForwardTimeSetting = preferences.afm_time
$ oldAutoForwardEnabledSetting = preferences.afm_enable

#enable auto-forward mode
$ preferences.afm_time = 15
$ preferences.afm_enable = True

#run for some time with auto-forward enabled, call a message screen or w/e
[...]

#restore user settings
$ preferences.afm_time = oldAutoForwardTimeSetting
$ preferences.afm_enable = oldAutoForwardEnabledSetting
return()
 
  • Like
Reactions: bockytocky

ChaosDMNS

Member
Sep 18, 2018
107
134
Auto-forward shouldn't be forced on and most certainly not "hard-wired" into the script, IMHO.
Auto-forward can be toggled by the player from the quick menu "Auto" button and it should be his choice to switch it.
It's better not to force-disable or enable things that are set in Ren'Py by default.

Please, do not code it into your script. Players won't like it and one of them will provide a patch to others to override it, anyway. You will just "lose a point" there to the person who provides that patch.

Why do you want to auto-forward text, anyway?

Just so you'd know - only some players like it and use it, a whole lot of them don't use it and some hate it. For example, I find it most annoying, I never use it and when I find it being forced on, I just disable it any way I can.
I know it's an old post I'm replying to. but it popped up in google. and I just had to give my two cents.

I hate you..

.. not really... But I does annoy me that you advice ppl to remove the auto button.. I use it all the time. and I go so far as to edit the game to add the auto button back inn, or atleast a keyboard hotkey for it.

But I do agree with you that it shouldn't be enabled by default. omg.. that would be even more annoying.

ffs. some times I just like to other stuff for a sec seconds/minutes.. like eat a sandwitch, or light up a cigarette, or there is so much text to read that I just can't be bothered sitting there and clicking forever.

So.. Just.. leave auto forward inn.. let it be easily available, and if you can.. add a keyboard binding to it also.
 

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,909
6,631
I know it's an old post I'm replying to. but it popped up in google. and I just had to give my two cents.

I hate you..

.. not really... But I does annoy me that you advice ppl to remove the auto button.. I use it all the time. and I go so far as to edit the game to add the auto button back inn, or atleast a keyboard hotkey for it.

But I do agree with you that it shouldn't be enabled by default. omg.. that would be even more annoying.

ffs. some times I just like to other stuff for a sec seconds/minutes.. like eat a sandwitch, or light up a cigarette, or there is so much text to read that I just can't be bothered sitting there and clicking forever.

So.. Just.. leave auto forward inn.. let it be easily available, and if you can.. add a keyboard binding to it also.
Wow, you read my post and didn't understand a thing I said. :oops: In fact, you turned its meaning around a full 180°.

I most definitely did not advise people to remove the auto button. On the contrary - I said that in case auto forward has been forced on, I always try to disable the forwarding itself. I never mentioned anything about removing the button! :FacePalm: Where did you get that idea?
I clearly said that the player should be able to switch it on or off by using the Auto button, it just shouldn't be forced on from the start.

Just look at my transparency patch, I created a quick menu with all the default buttons and more for it especially for the games where the quick menu has been disabled, hidden or some of its buttons removed by the developer!
 
Last edited:

ChaosDMNS

Member
Sep 18, 2018
107
134
Wow, you read my post and didn't understand a thing I said. :oops: In fact, you turned its meaning around a full180°.
lol. sorry. I was a little drunk and tired when I read your post. could barely keep my eyes open. went to bed 5 min after.

I read "It's better to force-disable" I guess I didn't see the NOT part..

I though you complained about ppl force enable it. and said it was better to force disable it, as nobody used it anyway.


So.. my bad.. I blame beer and staying up all night =D
 
  • Like
Reactions: Penfold Mole

Erack

Newbie
Sep 11, 2018
16
5
Necro'ing this post, since someone mentioned it and maybe someone will search and find this post.

My solution for toggling auto-forward evolved over time. Eventually I ended up with a custom script file that I just put in the /game/ folder of each new RenPy game I'm about to start playing. It sets up a key I can toggle "auto-forward" on and off (ALT + PGUP), even if the original game hides the standard quickbar, etc. So to the OP... Yes, you can bind it to to a key and an example is included as part of the script I'm attaching.

My script also sets the defaults for things I like (such as starting in Fullscreen, specific sound/music volumes and specific text speeds and auto-advance timer).

As long as I put the script file there before I start the game for the first time, it picks up the defaults *I WANT* rather than the standard system ones. But without changing any values that would affect a game already in progress (except the keybind).

The keybind works on 99% of games... but there are exceptions. Just count those as the developer being too clever for their own good.

Anyway, if anyone wants to try it... I'm attaching my current version here.
(feel free to delete any default overrides you personally don't like or change them to values you do).
The name of the file can be anything. I just picked one that I knew wouldn't conflict with any game now or in the future.
Guess it's a necro again, just wanted to say that I appreciate the file man, I'm not sure why it seems like some people are against even having the option there for those that want it without having to dig around and figure out what values to manually change to enable it. Auto forward is almost a must have for me when it comes to these games.
 
  • Like
Reactions: 79flavors

Jake2000

Member
Oct 14, 2018
332
785
Necro'ing this post, since someone mentioned it and maybe someone will search and find this post.

My solution for toggling auto-forward evolved over time. Eventually I ended up with a custom script file that I just put in the /game/ folder of each new RenPy game I'm about to start playing. It sets up a key I can toggle "auto-forward" on and off (ALT + PGUP), even if the original game hides the standard quickbar, etc. So to the OP... Yes, you can bind it to to a key and an example is included as part of the script I'm attaching.

My script also sets the defaults for things I like (such as starting in Fullscreen, specific sound/music volumes and specific text speeds and auto-advance timer).

As long as I put the script file there before I start the game for the first time, it picks up the defaults *I WANT* rather than the standard system ones. But without changing any values that would affect a game already in progress (except the keybind).

The keybind works on 99% of games... but there are exceptions. Just count those as the developer being too clever for their own good.

Anyway, if anyone wants to try it... I'm attaching my current version here.
(feel free to delete any default overrides you personally don't like or change them to values you do).
The name of the file can be anything. I just picked one that I knew wouldn't conflict with any game now or in the future.
You're file doesn't work, dude. I tried. Can you tell me what I'm doing wrong? Or your file need to be updated.
 
  • Like
Reactions: no1milfhunter

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,561
2,181
You're file doesn't work, dude. I tried. Can you tell me what I'm doing wrong? Or your file need to be updated.

I still use a version of it practically every day, so yes... it still works.

As to what you might be doing wrong, I'm not sure.
The first idea that comes to mind is that you are putting the file in the wrong place. It should go in the game's /game/ folder.

Beyond that, I wonder what your expectations are. Perhaps you're expecting it to do something it doesn't actually do. It adds a keyboard toggle for auto-forward. Once the file is put in the game's directory, you should be able to press [ALT+PGUP] to toggle whether auto-advance is active or not. You can edit the file to use a different combination of keys... I dunno, if you're perhaps using a laptop where the PageUp key isn't easily used.

The other settings... The sound volumes are only set for the very first time the game is run and the file must be placed in the game's folder before the game is run for the first time. After that, the volume is left completely alone so the player can change it to whatever they like without this file constantly resetting it for them.

The most obvious sign the file is working correctly though is the way the game's dialogue is displayed. By default, most games show the text immediately. My file changes the default behavior so that text is shown progressively, almost like one character at at time at what is a comfortable reading speed for myself. Again, this is only the "default" behavior and can only be done by copying the file before the game is run for the first time. After that, it will use whatever settings the player was already using.
 

bubak

New Member
Feb 2, 2018
13
9
My solution for toggling auto-forward ..... that would affect a game already in progress (except the keybind).
If someone tries it out with an already started game, like me now, it finishes with an error, BUT if I (after some searching and testing) edit the code like bellow, it works great (except for keybinding, as mentioned, which probably causes that error, so after some trying I just delete it). And you can fine-tune text speed and auto-forward time later in preferences normally, using the sliders :) After loading a save it takes a few seconds to start auto-forward (it may confuse you for the first time).

PS: I am just a "user" - player, do not know anything about the code ;) I am just trying and testing some "guides" here and there... ;)

Code:
default preferences.text_cps = 100
default preferences.afm_time = 10
default preferences.afm_enable = True

init 990 python:
    config.developer = True
    config.console = True

    config.default_music_volume = 0.15
    config.default_sfx_volume = 0.5

    config.default_fullscreen = True
    preferences.afm_time = 10
    preferences.text_cps = 100
    preferences.afm_enable = True
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,561
2,181
If someone tries it out with an already started game, like me now, it finishes with an error,
[...]
(except for keybinding, as mentioned, which probably causes that error, so after some trying I just delete it).

The keybind error is only very specific games. It works 99%* of the time.
* 86.4% of all statistics quoted on the internet are made up on the spot.

I did think about coding around it, but it happens so infrequently - I just kept things simple.

And yeah, altering the preferences that way works. I was purely trying to avoid forcing values onto other people.

I know you're not a coder (and what you've written is fine), but I'll mention this for the benefit of other people... The advice in the documentation is not to set preferences this way... but instead to use the function.
You also wouldn't need to set the default values, when you are immediately overriding them anyway. So the default lines aren't technically needed any more.

So the code would look like...
Python:
default preferences.text_cps = 36
default preferences.afm_time = 6.5

init 990 python:
    config.developer = True
    config.console = True

    config.default_music_volume = 0.15
    config.default_sfx_volume = 0.5

    config.default_fullscreen = False
    config.keymap['toggle_afm'].append("alt_K_PAGEUP")

    if hasattr("config", "has_sync"):
        config.has_sync = False
Edited to reflect suggestions by Anne. (and still untested by me, because I'm a slacker today).
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,236
14,997
You also wouldn't need to set the default values, when you are immediately overriding them anyway.
In fact it's the opposite that happen. default is proceeded when the game start (or a save is loaded), therefore the values override the ones he defined at init time. Not that it change something to the problem.


Python:
    Preference("auto-forward time", 10)
    Preference("text speed", 100)
    Preference("auto-forward", "enable")
Preference is a screen action, therefore this will not works as you expect it ; it will return an object that will change the value when called. It have to be wrote like this:
Python:
    Preference("auto-forward time", 10)()
    Preference("text speed", 100)()
    Preference("auto-forward", "enable")()
 
  • Like
Reactions: 79flavors

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,561
2,181
In fact it's the opposite that happen. default is proceeded when the game start (or a save is loaded), therefore the values override the ones he defined at init time. Not that it change something to the problem.
This is what happens when I type something on the forums I haven't tested beforehand.
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.
Not that it matters in this case, as you say.

Preference is a screen action
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.