Is there anything like a "pause game" button/ pause game when clicking on textbutton?

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.
Post Reply
Message
Author
User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Is there anything like a "pause game" button/ pause game when clicking on textbutton?

#1 Post by Nanahs »

I'm using a messenger code.

Code: Select all

label jhontalk3:
    scene messengerbg
    show screen telegram
    show screen info
    show screen playerchoices

    $ msg("{color=#0000ff}[jhonname]:{/color}  \n   Hi Anna!!", who=1)
    $ msg("{color=#0000ff}[jhonname]:{/color}   \n   How are you???", who=1)
    $ msg("{color=#0000ff}[jhonname]:{/color}   \n   I heard you just started college.", who=1)
All thoses messages that Jhon sends you are automatic. You don't have to keep clicking on the game screen. I think it makes the chat more realistic.

In a corner I added a screen called "playerchoices", where the player can add/customize a few things.

I was thinking if it's possible to add an option called "Pause game", that would have the same funcion as "$ renpy.pause()", so the person would be able to pause the game for a while. Maybe they need a pause before reading the other messages.

But I've never found anything like that for Renpy. Like, there isn't anything as "action Pause(renpy)" :lol: :?:

I was wondering if an "action pause game" exists or not.
I didn't find it in documentations.

_______________________________

PS: oh, actually it would be better if inside screen "playerchoices" I could use something like the "$ renpy.pause()", so this screen "pauses" the game and I don't need to create an extra button.
So I should use "NullAction()", right? But how would that work in a screen full of textbuttons?

Code: Select all

screen playerchoices():

    add "playerchoices.png"
    frame:
        style_group 'status'
        align(0.5, 0.5)
        has vbox 
        
        textbutton "{size=30}Playlist{/size}" action ToggleScreen("songs")
        null height 10
        textbutton "{size=30}Contacts{/size}" action ToggleScreen("contactnames")
        null height 10

Actually what I really need is the game to pause when you click on "playerchoices" textbutton. This screen is shown buy a "ToggleScreen". So when I click "playerchoices" again to hide it, the game would go on.

Thanks.
Last edited by Nanahs on Sat Feb 02, 2019 7:43 pm, edited 5 times in total.

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Is there anything like a "pause game" button?

#2 Post by wyverngem »

This seems a lot of work for something that is already a part of the Renpy program in the Auto-Forward function. I strongly recommend that you use it instead because you are making your game inaccessible for those who use the self-voicing feature by forcing the game to auto-forward to the next line. The reader can't read the screen for them if you do something like this.

You can however, use this:

Code: Select all

$ Preference("auto-forward","enable")
Place it in your start label and the game will auto-forward with the settings there. To set auto-forward automatically and use other features so that by clicking the player doesn't stop auto-forwarding.

It function just like you want. Pausing anytime you "call" a screen or access the game_menu. Here are the other auto-froward settings you can use pre-built into the game.

Code: Select all

preferences.afm_after_click = False
If True, auto-forward move will be continue after a click. If False, a click will end auto-forward mode. The equivalent of the "auto-forward after click" preference.

preferences.afm_time = 15
The amount of time to wait for auto-forward mode. Bigger numbers are slower, though the conversion to wall time is complicated, as the speed takes into account line length. The equivalent of the "auto-forward" preference.

define config.afm_bonus = 25
The number of bonus characters added to every string when auto-forward mode is in effect.

define config.afm_callback = None
If not None, a Python function that is called to determine if it is safe to auto-forward. The intent is that this can be used by a voice system to disable auto-forwarding when a voice is playing.

define config.afm_characters = 250
The number of characters in a string it takes to cause the amount of time specified in the auto forward mode preference to be delayed before auto-forward mode takes effect.

define config.afm_voice_delay = .5
The number of seconds after a voice file finishes playing before AFM can advance text.

User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: Is there anything like a "pause game" button?

#3 Post by Nanahs »

wyverngem wrote: Sat Feb 02, 2019 6:38 pm This seems a lot of work for something that is already a part of the Renpy program in the Auto-Forward function. I strongly recommend that you use it instead because you are making your game inaccessible for those who use the self-voicing feature by forcing the game to auto-forward to the next line. The reader can't read the screen for them if you do something like this.

You can however, use this:

Code: Select all

$ Preference("auto-forward","enable")
Place it in your start label and the game will auto-forward with the settings there. To set auto-forward automatically and use other features so that by clicking the player doesn't stop auto-forwarding.

It function just like you want. Pausing anytime you "call" a screen or access the game_menu. Here are the other auto-froward settings you can use pre-built into the game.

Code: Select all

preferences.afm_after_click = False
If True, auto-forward move will be continue after a click. If False, a click will end auto-forward mode. The equivalent of the "auto-forward after click" preference.

preferences.afm_time = 15
The amount of time to wait for auto-forward mode. Bigger numbers are slower, though the conversion to wall time is complicated, as the speed takes into account line length. The equivalent of the "auto-forward" preference.

define config.afm_bonus = 25
The number of bonus characters added to every string when auto-forward mode is in effect.

define config.afm_callback = None
If not None, a Python function that is called to determine if it is safe to auto-forward. The intent is that this can be used by a voice system to disable auto-forwarding when a voice is playing.

define config.afm_characters = 250
The number of characters in a string it takes to cause the amount of time specified in the auto forward mode preference to be delayed before auto-forward mode takes effect.

define config.afm_voice_delay = .5
The number of seconds after a voice file finishes playing before AFM can advance text.
Thank you! I haven't tried to use those functions. Maybe they can be helpful. Thank you :)

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

Re: Is there anything like a "pause game" button/ pause game when clicking on textbutton?

#4 Post by Imperf3kt »

I think if you wanted to keep things the way they are, you could use a call.
Call a blank screen with modal True, possibly also tag menu, and on that screen place a near invisible button that takes up the entire screen, upon clicking the action should be a Return(), which will close the screen and resume the game

At least, I think that should do what you want. I haven't actually tested it.
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
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: Is there anything like a "pause game" button/ pause game when clicking on textbutton?

#5 Post by Nanahs »

Imperf3kt wrote: Sat Feb 02, 2019 8:29 pm I think if you wanted to keep things the way they are, you could use a call.
Call a blank screen with modal True, possibly also tag menu, and on that screen place a near invisible button that takes up the entire screen, upon clicking the action should be a Return(), which will close the screen and resume the game

At least, I think that should do what you want. I haven't actually tested it.
Thank you! I'll try this one too :)

Post Reply

Who is online

Users browsing this forum: 3N16M4, Bing [Bot], MisterPinetree, Ocelot