Define Carracter with condition.

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
Hoseigndie
Regular
Posts: 31
Joined: Sat Jun 02, 2018 3:00 pm
Contact:

Define Carracter with condition.

#1 Post by Hoseigndie »

Hello all,

This is my problem. I want to make a multi-language games.
This is my exemple code for dialogue in the game :

bob "[dia1]"

and this is my code for dialogue :

define dia1 = Character("Hello!")
define dia2 = Character("Very nice...")
etc ...

I have a option in the beginning (for english_langu or french_langu). I want to change the "dia1" with condition. I test this code but it disn't work ....

if english_langu:
define dia1 = Character("Hello!")
define dia2 = Character("Very nice...")

if french_langu:
define dia1 = Character("Bonjour!")
define dia1 = Character("Très jolie...")


Sorry for my english ...

User avatar
plaster
Regular
Posts: 89
Joined: Thu Jul 11, 2013 1:03 am
Tumblr: plasterbrain
Soundcloud: plasterbrain
Location: Chicago
Contact:

Re: Define Carracter with condition.

#2 Post by plaster »

Have you looked at Ren'Py's built-in translation framework? Just write everything in one language:

Code: Select all

bob "Hello!"
bob "Very nice..."
... and then when you're done, click Generate Translations in the launcher and make a translation called "french". Then in game/tl/french you'll see a copy of the game's scripts. You can edit those and fill in your French translations, which will look something like this when you're done:

Code: Select all

translate french strings:

    old "Hello!"
    new "Bonjour!"

    old "Very nice..."
    new "Très jolie..."
Then instead of your custom language variable, use _preferences.language to get the current language name ("french" or None for English). You can change the language in the script with renpy.change_language("french") or from a screen using action Language("french")

Hoseigndie
Regular
Posts: 31
Joined: Sat Jun 02, 2018 3:00 pm
Contact:

Re: Define Carracter with condition.

#3 Post by Hoseigndie »

Thx, I will see that ;)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Nozori_Games, voluorem