How change img in main menu, depending on language?(SOLVED)

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
AnnTenna
Newbie
Posts: 12
Joined: Tue Oct 13, 2009 9:40 am
Completed: Flying Ship, Kitten adventures in city park
Contact:

How change img in main menu, depending on language?(SOLVED)

#1 Post by AnnTenna »

The problem is that I can't find a way to change main menu background depending on selected language.

Before the start menu, user selects the language in script.rpy

Code: Select all

label splashscreen: 
$ result = renpy.imagemap("1.jpg", "2.jpg", [
(0, 0, 480, 160, "Rus"),     
(0, 160, 480, 320, "Eng"),
])

if result == "Rus":
$ England = False
jump lang
elif result == "Eng":
$ England = True          
jump lang
Then, if the menu is in Russian, it is translated:

Code: Select all

label lang:   
if England:      
jump nenado
$ config.translations = {
"Skip Mode" : u"Режим прокрутки",
"Empty Slot." : u"Здесь пусто!",
"Yes" : u"Да",
"No" : u"Нет",
"Are you sure you want to quit?" : u"Точно хочешь выйти?",
"Quit" : u"Выход",
"Main Menu" : u"В главное меню",
"Load Game" : u"Загрузить",
"Save Game" : u"Сохранить",
"Preferencest" : u"Настройки", # etc.
}
label nenado: return
So buttons in menu will be writed in English if English language is being selected, and in Russian if Russian is chosen.

But there is one problem. I need to get a picture on the background of the main menu has been different for English and Russian versions. How change img in main menu, depending on language?

I found, how to change menu background:

options.rpy

Code: Select all

## The background of the main menu. This can be a color
## beginning with '#', or an image filename. The latter
## should take up the full height and width of the screen.

mm_root = "beginE.jpg",
But it seems like this block invokes before label splashscreen: So what do we do? :shock:
Last edited by AnnTenna on Thu Mar 07, 2013 4:40 am, edited 1 time in total.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: How change img in main menu, depending on language?

#2 Post by Donmai »

What version of Ren'Py are you using? If you are in 6.15, then you are in luck! When you generate translations in 6.15, it will create a tl folder with a named language folder inside. All you need to do is to put your translated pictures inside that folder. But you need to recreate the paths there, I mean: if your picture is in, say, game/ui/picture.jpg, then you will need your translated picture with the same name to be in tl/(language)/ui/picture.jpg. And that's all! Ren'Py will do the rest for you, updating the pictures as soon as the language is changed.

Edit: here is the documentation for translated games in Ren'Py 6.15:
http://www.renpy.org/dev-doc/html/trans ... ranslation
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

AnnTenna
Newbie
Posts: 12
Joined: Tue Oct 13, 2009 9:40 am
Completed: Flying Ship, Kitten adventures in city park
Contact:

Re: How change img in main menu, depending on language?

#3 Post by AnnTenna »

Amazing! 0_о

Now I'm using version 6.13. But now I think about switching to 6.15!

Thank you!
---------------------------------------

Edit: Problem solved!!!

Code: Select all

screen main_menu:
    if England:
        add "eng.png"
    else:
        add "rus.png"
---------------------------------------
Edit:
warning!!!
For this to work, rename the variable England in persistent.england !!!

Post Reply

Who is online

Users browsing this forum: Imperf3kt, Ocelot