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.
neometalero
Regular
Posts: 198 Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:
#1
Post
by neometalero » Sun Jul 28, 2019 1:51 pm
Im using this language chooser, but after the restart if I start the game again it goes to this menu again, is there any way so I can save the chose option?
Code: Select all
label language_chooser:
scene black
menu:
"English":
$ renpy.change_language(None)
"Español":
$ renpy.change_language("espaniol")
$ renpy.utter_restart()
also if I dont put the line
the code continues but then the correct language is not selected (only the default one). Any ideas?
Kia
Eileen-Class Veteran
Posts: 1040 Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:
#2
Post
by Kia » Mon Jul 29, 2019 12:48 pm
you can use a persistent variable:
https://www.renpy.org/doc/html/persistent.html
Code: Select all
if not persistent.lang_check:
menu:
"English":
$ renpy.change_language(None)
"Español":
$ renpy.change_language("espaniol")
$ persistent.lang_check = True
$ renpy.utter_restart()
xavimat
Eileen-Class Veteran
Posts: 1461 Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:
#3
Post
by xavimat » Wed Jul 31, 2019 9:59 am
The "change language" function already restarts renpy (or something like that). It's possible that your lines after the menu are not executed. Be sure to change the persistent variable immediately before the change_language but not before the menu:
Code: Select all
if not persistent.lang_check:
menu:
"English":
$ persistent.lang_check = True
$ renpy.change_language(None)
"Español":
$ persistent.lang_check = True
$ renpy.change_language("espaniol")
neometalero
Regular
Posts: 198 Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:
#4
Post
by neometalero » Thu Aug 01, 2019 4:06 pm
Tks I will try this, and see if its works.
neometalero
Regular
Posts: 198 Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:
#5
Post
by neometalero » Thu Aug 01, 2019 4:59 pm
Kia wrote: ↑ Mon Jul 29, 2019 12:48 pm
you can use a persistent variable:
https://www.renpy.org/doc/html/persistent.html
Code: Select all
if not persistent.lang_check:
menu:
"English":
$ renpy.change_language(None)
"Español":
$ renpy.change_language("espaniol")
$ persistent.lang_check = True
$ renpy.utter_restart()
this one worked fine for me tks!