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.
All the init blocks are executed before the game starts, it doesn't matter where you put them in your code.
The quit action can be done with a button on the screens (Main and Navigation; in the Main Menu the confirm is already disabled, you can configure them in screens.rpy); and with the "close" button of the window (that uses the config.quit_action).
Btw, why do you want to do this? In your code it seems that has something to do with the lang chosen. What do you want to achieve?
@xavimat
it's kinda complicated.
At the beginning of my game, there is a language and screen resolution picking screen.
at that part, if player clicks x (close widows) it will show up yesno quit prompt that is bigger.
After I tried several method, I found out disabling yesno quit prompt at the beginning and turn it back at the main game is the easiest.
If I understand correctly, this only is used when somebody opens your game and immediately closes it with the X button (really improbable). Once one language is chosen, there is no problem. How much do you want to work only for this?
Maybe you can simply modify the yesno screen to present a message in all languages only in case of "persistent.chose_lang is None"
@xavimat
exactly. only it's the language and the screen resolution.
i've already spent hours modifying yesno screen and couldn't make it work.
so if i can't turn off "quit confirm" at the beginning and turn it back at the main game, i can't help but i'd turn it off the entire game.
init python:
quit_trigger = True
config.quit_action = Quit(confirm=quit_trigger) # maybe (confirm=eval(quit_trigger)) is needed, not tested it.
label start:
$ quit_trigger = False
###INTRODUCTION OF THE GAME###
$ quit_trigger = True
###MAIN GAME###
You still declare config_quit.action only in init, and attach it's property to a True variable, which only becomes false while in into. No need for persistent flags or anything.
Edit: Not working indeed. Flawed logic on my part.
Last edited by Tsapas on Mon Nov 11, 2013 8:54 am, edited 1 time in total.
init python:
quit_trigger = True
label start:
$ quit_trigger = False # If false, the game will quit without prompt.
###INTRODUCTION OF THE GAME###
$ quit_trigger = True # If true, when hitting "X" you'll get a prompt.
###MAIN GAME###