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.
-
Nayru
- Regular
- Posts: 35
- Joined: Thu Sep 03, 2009 6:47 pm
- Projects: Short OC's BL game
- Location: The less expected place
-
Contact:
#1
Post
by Nayru » Thu Oct 22, 2009 5:42 pm
Assistance please?
I've been having problems since I tried In-line translation for my Visual Novel project. I've been working with renpy version 6.9.1 then switched to 6.9.3 but I still got this error:
Code: Select all
I'm sorry, but an exception occured while executing your Ren'Py
script.
UnicodeDecodeError:
While running game code:
- script at line 282 of K:\renpy-6.9.3\La Llei de Mitjanit/game/script.rpy
-- Full Traceback ------------------------------------------------------------
File "K:\renpy-6.9.3\renpy\bootstrap.py", line 260, in bootstrap
File "K:\renpy-6.9.3\renpy\main.py", line 308, in main
File "K:\renpy-6.9.3\renpy\main.py", line 92, in run
File "K:\renpy-6.9.3\renpy\execution.py", line 230, in run
File "K:\renpy-6.9.3\renpy\ast.py", line 341, in execute
File "K:\renpy-6.9.3\renpy\exports.py", line 507, in say
File "K:\renpy-6.9.3\renpy\character.py", line 523, in __call__
File "K:\renpy-6.9.3\renpy\python.py", line 950, in py_eval
File "K:\renpy-6.9.3\renpy\python.py", line 219, in py_compile
UnicodeDecodeError:
While running game code:
- script at line 282 of K:\renpy-6.9.3\La Llei de Mitjanit/game/script.rpy
Ren'Py Version: Ren'Py 6.9.3c
I've been trying to translate it to three different languages.
Even if it's not related to this so far I've only noticed as a strange thing that when I write "None" it appears in black font when in the example of In-line translation "None" appears in brown font "[/color]
None"
Code: Select all
$ en = Character (None, condition='lang == "english"')
$ sp = Character (None, condition='lang == "castellano"')
$ ca = Character (None, condition='lang == "català"')[/quote]
[quote]init python:
en = Character(None, condition='lang == "english"')
jp = Character(None, condition='lang == "japanese"')
en_e = Character("Eileen", condition='lang == "english"')
jp_e = Character(u"光", condition='lang == "japanese"')
Sorry if this is a basic question, I'm a beginner and s*ck at programming.
If this is not the right place to post this assistance question, please correct me and sorry in advance, it was the closest I found.
Last edited by
Nayru on Fri Oct 23, 2009 6:31 pm, edited 1 time in total.
-
PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
-
Contact:
#2
Post
by PyTom » Thu Oct 22, 2009 6:11 pm
When using Python strings containing non-English characters, like:
"català"
you need to prefix the string with a u. You also need to ensure you're saving the file with the UTF-8 encoding.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama •
https://www.patreon.com/renpytom
-
Nayru
- Regular
- Posts: 35
- Joined: Thu Sep 03, 2009 6:47 pm
- Projects: Short OC's BL game
- Location: The less expected place
-
Contact:
#3
Post
by Nayru » Thu Oct 22, 2009 6:28 pm
Thanks for the quick reply. I'll take a bit of time to learn the basics of how to ensure the encoding is UTF-8.
Also by prefixing with u do you mean like this?
u $ ca = Character (None, condition='lang == "català"')
or like this?
u init python:
Could you give me an example please?
-
JQuartz
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
-
Contact:
#4
Post
by JQuartz » Fri Oct 23, 2009 12:10 am
Nayru wrote:Could you give me an example please?
I think it's something like this:
Code: Select all
init:
$ en = Character (None, condition='lang == "english"')
$ sp = Character (None, condition='lang == "castellano"')
$ ca = Character (None, condition='lang == u"català"')
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
-
Wintermoon
- Miko-Class Veteran
- Posts: 701
- Joined: Sat May 26, 2007 3:41 pm
-
Contact:
#5
Post
by Wintermoon » Fri Oct 23, 2009 1:04 am
JQuartz wrote:Nayru wrote:Could you give me an example please?
I think it's something like this:
Code: Select all
init:
$ en = Character (None, condition='lang == "english"')
$ sp = Character (None, condition='lang == "castellano"')
$ ca = Character (None, condition='lang == u"català"')
Almost.
Code: Select all
init:
$ en = Character (None, condition='lang == "english"')
$ sp = Character (None, condition='lang == "castellano"')
$ ca = Character (None, condition=u'lang == u"català"')
-
Nayru
- Regular
- Posts: 35
- Joined: Thu Sep 03, 2009 6:47 pm
- Projects: Short OC's BL game
- Location: The less expected place
-
Contact:
#6
Post
by Nayru » Sat Oct 24, 2009 9:01 pm
Much thanks for all of your kind help. It was really useful and solved that error
. Also, I was busy with university, sorry for the late answer.
I'm getting a new error but this time it's more related to game menus. I'm currently trying to fix it. The default language is now "english" but previously it was "català". These are the three languages and their respective menus:
Code: Select all
init -3 python:
if persistent.lang is None:
persistent.lang = "english"
lang = persistent.lang
init -1 python hide:
if lang == "english":
config.developer = False
config.window_title = u"Midnight's Law"
config.main_menu = [
(u"Start", "start", "True"),
(u"Continue", _intra_jumps("load_screen", "main_game_transition"), "True"),
(u"Preferences", _intra_jumps("preferences_screen", "main_game_transition"), "True"),
(u"Quit", ui.jumps("_quit"), "True")
]
elif lang == "castellano":
config.developer = False
config.window_title = u"La Ley de Medianoche"
config.main_menu = [
(u"Empezar", "start", "True"),
(u"Continuar", _intra_jumps("load_screen", "main_game_transition"), "True"),
(u"Preferencias", _intra_jumps("preferences_screen", "main_game_transition"), "True"),
(u"Salir", ui.jumps("_quit"), "True")
]
elif lang == u"català":
config.developer = False
config.window_title = u"La Llei de Mitjanit"
config.main_menu = [
(u"Començar", "start", "True"),
(u"Continuar", _intra_jumps("load_screen", "main_game_transition"), "True"),
(u"Preferències", _intra_jumps("preferences_screen", "main_game_transition"), "True"),
(u"Sortir", ui.jumps("_quit"), "True")
]
The problem is that with the last language "català", a different menu is launched. Instead of being the one I wrote above it's something like:
Start game
Load Game
Preferences
Help
Quit .
Also the help option only appears in this language.
I think this is because there are some default settings which I need to turn off. Currently trying to figure the script where they are located...
-
Wintermoon
- Miko-Class Veteran
- Posts: 701
- Joined: Sat May 26, 2007 3:41 pm
-
Contact:
#7
Post
by Wintermoon » Sat Oct 24, 2009 11:46 pm
Nayru wrote:The problem is that with the last language "català", a different menu is launched. Instead of being the one I wrote above it's something like:
Start game
Load Game
Preferences
Help
Quit .
Based on your code, this is what would happen if 'lang' isn't one of the three supported languages.
One thing that could be happening is that 'lang' uses the decomposed form of the character 'à' but you're comparing it to the precomposed form (or vice-versa). See
Unicode equivalence. The easiest way to prevent this is to simply use the English names for the languages, i.e. "catalan" instead of "català". (There is a
proper way to prevent this, but it's fairly complicated and error-prone. I wouldn't recommend it.)
-
Nayru
- Regular
- Posts: 35
- Joined: Thu Sep 03, 2009 6:47 pm
- Projects: Short OC's BL game
- Location: The less expected place
-
Contact:
#8
Post
by Nayru » Sun Oct 25, 2009 7:45 am
Oh thanks again! ^-^ Then I'll try the easy way and tell you what happens...
EDIT: It works fine now!
Problem solved ^-^ Thanks!
Users browsing this forum: Google [Bot]