• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

Tutorial Ren'Py Fixing Errors in Renpy Games

Moricano

Well-Known Member
Jan 30, 2019
1,663
1,114
I don't think someone gave the link, so the page of regarding translation. Which is what I mean and what you should read before continuing to do translation. Not that I'm against the idea of a translation, whatever the language but because, like scrumbles implied, it will really ease your works when you'll do it correctly.




Ren'py have really nothing in common with Gamebryo, even the Bethesda's modified version. And in this discussion, the main reason is that Ren'py offer a native translation system.
You don't even need a dedicated thread, just post on the game thread to give the link to the translation files, then add a mod to update the OP. Then player using the translation can at anytime during their play, pass from English to Portuguese, Portugues to English, without the need to do more than click on a button (that you have to add).
It doesn't matter if you're a little late for the update of the translation, the file will still works, just presenting in English the dialog that haven't been translated.




No. Sorry to say that, but presented like that, it's one of the worse, and Belle is right when saying that it's more an example of how not to fix an error, and how not to translate a game ; which isn't a problem by itself, you just still have to learn and, more important, are apparently whiling to to it.
It works, more or less, in your particular case, where there's two original files (your translation and the original game) and the error is due to the translation. But for all the other cases, so 99% of the "there's an error in this game", it will not effectively works.
You encountered easy to fix errors, because you're only working on translation and by default don't touch to the code, but those are exceptions.

Just take a classical (quoted from memory), "_menu screen not found". Most of the time it's due to the enabling of the developer mode, and in 100% of the case, the said "_menu screen", exist, can be found, and have absolutely nothing to see with the error.
There's also the classical case of recursion :
Code:
define m = Character( "[m]" )
[...]
    $ m = renpy.input( "John" )
that throw an exception totally not related with the effective error, and can throw it three months after the wrong line was effectively wrote. If my memory don't betray me, there's one person in this thread that encountered it.
Same for the last fix I've done, two/three days ago, because a dev used my Dynamic String Patcher, but didn't updated the definitions. If you're not me (yet it took me time to understand the cause), or don't take a look at the code of the said patcher, you'll never found, nor understand, why you've "I FORGOT TO SET THIS" that appear on the dialogs. It's obviously a bug, and at least two people reported it, but you can look at the dialog line and the code of the game all you want, you'll not find the reason.
Fixing bugs is way more complicated that just reading the traceback. I think I said it above, half of the time what you see in it say nothing about the real error, and don't even have, among the many lines listed, the line where the said error really is. Take this, that's the last traceback of a mod I'm working on :

Now, if with this you can tell me that the error come from the line X of another file (not listed in the traceback), where a variable, conditionally returned by the p function, is overwrote by a string, well you're better than me. Took me 10 minutes and a lot of debug text to find it.
And this is the kind of error people report concerning games. Like I said previously, the traceback show where the error break the game, not where it effectively is located.
Thanks for the tips and attention.
There were so many answers that I need to study every thing that has been passed to me rather complex but I think I can slowly understand and make use of everything that was passed to me.
Thank you.
 
  • Like
Reactions: anne O'nymous

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,202
14,939
[...] but I think I can slowly understand and make use of everything that was passed to me.
I can't talk for the others, but I'm sure that, like me, they wouldn't have took the time to write all this if they didn't thought that it can help you. So, take your time, we were all at your place at first.
 

Moricano

Well-Known Member
Jan 30, 2019
1,663
1,114
I can't talk for the others, but I'm sure that, like me, they wouldn't have took the time to write all this if they didn't thought that it can help you. So, take your time, we were all at your place at first.
Thanks for the attention and support and tips given .... have a nice day friend.
 

Moricano

Well-Known Member
Jan 30, 2019
1,663
1,114
I'd say engrish is the problem here. It's hard to understand what you actually mean Moricano The way you explained it in the op is not correct and barely understandable in english.
:oops:
I understand when our language is not the same it is kind of incomprehensible for you to understand what people of another race who say our English ends up making a total confusion.
I think I better stop trying to post certain (unwatch) or (Post) in this forum. I'm sorry for the bad english my after all my native language is Brazilian Portuguese .... There are many people in my nation who speak basic English or even complete among many other languages ..... but until today I have not seen an American or other from other nations spoke nothing of my own language, why is it?
I try my best to collaborate but I will stop posting Post or Quotes in this forum since no one is understanding .... sorry again for the bad english my ..... have a nice day. (y)
 

Higurashika

Well-Known Member
Nov 15, 2018
1,371
1,972
Maybe someone could help me to fix one issue. Because i don't understand what's wrong.

I define characters as usual:

define a = Character("anna", what_prefix='"', what_suffix='"')
define b = Character("beth", what_prefix='"', what_suffix='"')
define c = Character("cory", what_prefix='"', what_suffix='"')

So when they speak it goes with quotation marks. At least it should go. But works only for char cory. And i don't get it! Why?
 

scrumbles

Engaged Member
Jan 12, 2019
2,264
2,314
So when they speak it goes with quotation marks. At least it should go. But works only for char cory.
What if you escape the quotation marks?
Code:
define a = Character("anna", what_prefix="\"", what_suffix="\"")
define b = Character("beth", what_prefix="\"", what_suffix="\"")
define c = Character("cory", what_prefix="\"", what_suffix="\"")
 

Higurashika

Well-Known Member
Nov 15, 2018
1,371
1,972
What if you escape the quotation marks?
I want to display them when character speaks. It works only for one character. I need to understand why.

ps now it seems only main character (who can be named) has this problem :(
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,202
14,939
I want to display them when character speaks. It works only for one character.
There's absolutely no problems :
Code:
define a = Character("anna", what_prefix='"', what_suffix='"')
define b = Character("beth", what_prefix='"', what_suffix='"')
define c = Character("cory", what_prefix='"', what_suffix='"')

label start:
    a "I'm saying it"
    b "It works for me"
    c "Yeah, for me too"
    "END"

I need to understand why.
Because of something totally unrelated that is wrong somewhere else in your code.
 

Higurashika

Well-Known Member
Nov 15, 2018
1,371
1,972
anne O'nymous yeah you're right about default characters. But i can name mc, and for mc it doesn't work. I think the problem is in naming feature.
 

scrumbles

Engaged Member
Jan 12, 2019
2,264
2,314
ps now it seems only main character (who can be named) has this problem :(
Does your code do something like:
Code:
$ a = renpy.input("Rename the MC")
I fear this overwrite the object and reset the what_prefix, what_suffix properties.
Replace "anna" with a variable and change that, not "a".
 
  • Like
Reactions: anne O'nymous

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,202
14,939
anne O'nymous yeah you're right about default characters. But i can name mc, and for mc it doesn't work. I think the problem is in naming feature.
Code:
default mcname = "Some name"

define a = Character("[mcname]", what_prefix='"', what_suffix='"')
define b = Character("beth", what_prefix='"', what_suffix='"')
define c = Character("cory", what_prefix='"', what_suffix='"')

label start:

    a "I'm saying it"
    $ mcname = renpy.input( "name him" )
    a "Wait, it's not my name !"
    b "It works for me"
    c "Yeah, for me too"
    "END"
Still works fine.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,202
14,939
Because you have default name?
You also have one, else you would know it, Ren'py would throw this kind of exception :
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 243, in script
a "I'm saying it"
KeyError: u'mcname'
Or you did it in a strange way, which isn't the one you should have used and can, possibly, be the reason it don't works.
 

Higurashika

Well-Known Member
Nov 15, 2018
1,371
1,972
anne O'nymous i set player name with this code

$ plr = ""
$ plr = renpy.input("What is your name?")
$ plr = plr.strip()
if plr == "":
$ plr = "defaultname"

so in define line i write this

define plr = Character("Me", what_prefix='"', what_suffix='"')

Totally doesn't matter what stays instead of "Me". I could put there plr, [plr] or leave it blank. For plr suffix and prefix don't apply. I dunno mb it should be this way?
 

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,260
22,220
anne O'nymous i set player name with this code

$ plr = ""
$ plr = renpy.input("What is your name?")
$ plr = plr.strip()
if plr == "":
$ plr = "defaultname"

so in define line i write this

define plr = Character("Me", what_prefix='"', what_suffix='"')

Totally doesn't matter what stays instead of "Me". I could put there plr, [plr] or leave it blank. For plr suffix and prefix don't apply. I dunno mb it should be this way?
you forgot the \ in prefix and suffix.
 

Higurashika

Well-Known Member
Nov 15, 2018
1,371
1,972
you forgot the \ in prefix and suffix.
Where and why do i need it? If you say it should looks like

define plr = Character("plr", what_prefix="\"", what_suffix="\"")

it still doesn't work for MC. And for other characters it works fine without \
 

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,260
22,220
Where and why do i need it? If you say it should looks like

define plr = Character("plr", what_prefix="\"", what_suffix="\"")

it still doesn't work for MC. And for other characters it works fine without \
Oh I didn't see that you use the single ' instead of ", by bad.
What happens when you put
$ plr = "\"[plr]\""
right before label start?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,202
14,939
$ plr = renpy.input("What is your name?")
[...]
define plr = Character("Me", what_prefix='"', what_suffix='"')
Which is exactly the issue addressed by scrumbles , and something that can't works ; well at least never as expected. The variable named plr can not be both the name of the MC and the character object of the MC.

Use what I shown above and everything will be fine :
Code:
default plrName = "Me"
define plr = Character( "[plrName]", what_prefix='"', what_suffix='"')

label whatever:
    $ plrName = renpy.input("What is your name?").strip()
    if plrName == "":
        $ plrName = "defaultname"
 
  • Like
Reactions: Higurashika

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,202
14,939
$ plr = "\"[plr]\""
I put so much hope in you, why are you suddenly betraying me ? Sniff :ROFLMAO:

Haven't you noted the paradox when you wrote this line ?

You want to send Ren'py inside an endless loop from hell ?

Take this line, girl "Hey, [plr], glad to see you".

Ren'py will perform its interpolation, replacing [plr] by its value, "[plr]".
But before this, it will need to perform the interpolation in this string, therefore it will replace [plr] by its value, "[plr]".
But before this, it will need to perform the interpolation in this string, therefore it will replace [plr] by its value, "[plr]".
Wait, haven't I just wrote this line before ? :D


Edit: To be fair, it's too early in the year for me to be sure that my mind works correctly. I don't remember if Ren'py perform interpolation of interpolated text. But the problem stay anyway ;)
 

moskyx

Engaged Member
Jun 17, 2019
3,884
12,489
Also, you can always just copypaste that coding block from an existing game in which the player can name the MC. All of them work perfectly fine. You only need to understand that you have to set the variable [name], or [plrname], or [mc] or whatever you want to call it with a renpy.input string and then include that exact word between [ ] when you define the MC character.