Cant create Language options menu

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
neometalero
Regular
Posts: 107
Joined: Sun Oct 23, 2016 3:51 am
Deviantart: neometalero
Contact:

Cant create Language options menu

#1 Post by neometalero » Fri Jul 26, 2019 5:38 pm

I put this code in the options.rpy following this tutorial viewtopic.php?t=43333 but when I launch the game there is no Language menu visible, or error code, any Idea about what could be happening? tks!

Code: Select all

init -3 python:
    if persistent.lang is None:
        persistent.lang = "english"
    lang = persistent.lang
init python:
    config.main_menu.insert(3, (u'Language', "language_chooser", "True"))
init python:
    if lang == "english":
        style.default.font = "font_name_here_1.ttf" #english font here
    elif lang == "espaniol":
        style.default.font = "font_name_here_2.ttf" #espaniol font here
Working on Attack Helicopter Dating Simulator

Image

User avatar
namastaii
Eileen-Class Veteran
Posts: 1300
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life, Coffea Beans
Github: namastaii
Skype: Discord: lunalucid#7684
Soundcloud: deadseed
itch: lunalucid
Location: USA
Contact:

Re: Cant create Language options menu

#2 Post by namastaii » Fri Jul 26, 2019 6:05 pm

You need to prompt the user with menu choices that set the language or create your own screen with buttons that do the same thing.

Code: Select all

label language_chooser: 
    scene black 
    menu: 
        "{font=Arimo-Regular.ttf}English{/font}": $ renpy.change_language(None) 
        "{font=Arimo-Regular.ttf}Русский{/font}": $ renpy.change_language("russian")
    $ renpy.utter_restart() #alternatively, use "return" if you don't want to go to the main menu.

Code: Select all

hotspot(#,#,#,#) action ShowMenu("language_chooser") #insert coordinates appropriately
**edit: I realize that specific block of code is for a splash screen selection. I don't see it working either but it could be outdated? You could try implementing a section in the preferences menu possibly that selects language

User avatar
neometalero
Regular
Posts: 107
Joined: Sun Oct 23, 2016 3:51 am
Deviantart: neometalero
Contact:

Re: Cant create Language options menu

#3 Post by neometalero » Fri Jul 26, 2019 7:26 pm

namastaii wrote:
Fri Jul 26, 2019 6:05 pm
You need to prompt the user with menu choices that set the language or create your own screen with buttons that do the same thing.

Code: Select all

label language_chooser: 
    scene black 
    menu: 
        "{font=Arimo-Regular.ttf}English{/font}": $ renpy.change_language(None) 
        "{font=Arimo-Regular.ttf}Русский{/font}": $ renpy.change_language("russian")
    $ renpy.utter_restart() #alternatively, use "return" if you don't want to go to the main menu.

Code: Select all

hotspot(#,#,#,#) action ShowMenu("language_chooser") #insert coordinates appropriately
**edit: I realize that specific block of code is for a splash screen selection. I don't see it working either but it could be outdated? You could try implementing a section in the preferences menu possibly that selects language
Tks, I think I will use this code, but Im having a problem with the font, it says It cant find the Arimo-Regular.ttf file.
Working on Attack Helicopter Dating Simulator

Image

User avatar
namastaii
Eileen-Class Veteran
Posts: 1300
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life, Coffea Beans
Github: namastaii
Skype: Discord: lunalucid#7684
Soundcloud: deadseed
itch: lunalucid
Location: USA
Contact:

Re: Cant create Language options menu

#4 Post by namastaii » Fri Jul 26, 2019 7:34 pm

That's just an example. You don't even need to have it change font right there. I just pasted that from the tutorial you shared. Basically if you wanted to just open a menu in the dialogue (as a simple solution), all it would need to be is something like:

Code: Select all

label start:

        e "Hi, which language would you like?"

        menu:

            "English":
                $ renpy.change_language(None)
            "Русский":
                $ renpy.change_language("russian")
        $ renpy.utter_restart() #alternatively, use "return" if you don't want to go to the main menu.

User avatar
neometalero
Regular
Posts: 107
Joined: Sun Oct 23, 2016 3:51 am
Deviantart: neometalero
Contact:

Re: Cant create Language options menu

#5 Post by neometalero » Fri Jul 26, 2019 7:52 pm

namastaii wrote:
Fri Jul 26, 2019 7:34 pm
That's just an example. You don't even need to have it change font right there. I just pasted that from the tutorial you shared. Basically if you wanted to just open a menu in the dialogue (as a simple solution), all it would need to be is something like:

Code: Select all

label start:

        e "Hi, which language would you like?"

        menu:

            "English":
                $ renpy.change_language(None)
            "Русский":
                $ renpy.change_language("russian")
        $ renpy.utter_restart() #alternatively, use "return" if you don't want to go to the main menu.
Tks, that worked, but now it seems like it doesnt choose the files that needs to be using once I selected Epañol

Code: Select all

label language_chooser:
    scene black
    menu:
        "English":
            $ renpy.change_language(None)
        "Español":
            $ renpy.change_language("espaniol")
Working on Attack Helicopter Dating Simulator

Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]