Problems with my first game

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
Albie

Problems with my first game

#1 Post by Albie »

Hi.

I just tried to run the following code:

Code: Select all

init:
    image acordando = Image("a237.jpg")

label start:

    scene acordando

    "Depois de algum tempo desacordado, acordei."

	
For that, I got the error message:
I'm sorry, but an exception occured while executing your Ren'Py
script.

UnicodeDecodeError: 'utf8' codec can't decode bytes in position 333-335: invalid data

While loading the script.

-- Full Traceback ------------------------------------------------------------

File "run_game.py", line 61, in main
File "renpy\main.pyc", line 149, in main
File "renpy\script.pyc", line 189, in load_script
File "renpy\script.pyc", line 83, in __init__
File "renpy\script.pyc", line 109, in load_file
File "renpy\parser.pyc", line 1188, in parse
File "renpy\parser.pyc", line 37, in list_logical_lines
File "codecs.pyc", line 380, in read
File "codecs.pyc", line 253, in read
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 333-335: invalid data

While loading the script.

Ren'Py Version: Ren'Py 4.7
Could you help me finding out what I am doing wrong? Thanks

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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 »

Although it's not obvious from the snippet, it does look like you used some sort of international character (perhaps some sort of accent or something... I don't know offhand which language you're using... perhaps because I'm tired).

If you want to use your favorite language with Ren'Py, you'll have to save in the coding that supports all languages, UTF-8. How to do so varies by text editor. If you're using notepad on a recent version of Windows, the encoding is (IIRC) in the Save As box. If you're using SciTE, then the encoding can be chosen from the file menu.

Either way, if you save as UTF-8, things will probably start working. The error message, BTW, occurs 333 characters into the file, so I think that there's probably more to your script than you posted here.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Albie

#3 Post by Albie »

Hi, Tom,

Thank you very much for your response.

I thought it should be something like that (the encoding), so I had changed the encoding to utf8 already.

But the problem continued, but your second comment solved it all;

I had made a first test with lots of lines and, since I was getting the utf message, I made a copy of the file with Windows interface, generating a "Copy of script.rpy" file in my game directory!!!

So the problem was that this "backup" (which has of course more thatn 333 chars) was getting loaded and generating the error.

Anyway, thank you for helping me! BTW - the language I used is Portuguese.

Best Regards,

Albie

Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Google [Bot]