Tool Ren'Py Ren'Py Transparent Text Box Mod v2.6.4

5.00 star(s) 6 Votes

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,855
6,379


Less than 4 hours ago I finally found a way to override all the keyword and positional arguments defined in all character definitions with a single function ("hardcoded" who_ and what_ parameters in character definitions).

It was actually the first time I finally stumbled onto the page and browsing through the keywords there that seemed interesting, it took me only maybe 20 or 30 minutes to find - exactly what I've been looking for.
It is similar to the config.say_menu_text_filter that I've been using for quite some time in different places and game patches.

It worked right away on the first attempt almost the way I expected. Not exactly, but well enough to make most or all game-specific character definition overrides in my patch obsolete. I can finally scrap that crap from my patch and make it work for more games where the only problem is the way characters are defined.

Next version update will probably be numbered as v3 to mark this "breakthrough". Not tomorrow, but soon...

It's a shame really, that I haven't paid attention to something as important as the General Index page of Ren'Py documentation until now. It is right there, at the end of the welcome page of , but I can swear that it's really the first time I noticed it there... :FacePalm:
 
Last edited:

PAlNMON

Newbie
Aug 16, 2020
15
9
I'm a bit curious. Which Ren'Py game is stripped of its ability to compile rpy files?
The game is lewdlab's "Dreams of Desire". But my game went through translation. I think it even changes something, since I can't even change the text box (bg.png) in the root folder of the apk. And it took time to make the INC patch work. Until finding a .rpyc that did it worked.
 

PAlNMON

Newbie
Aug 16, 2020
15
9
but the version here on the site also comes with .rpyc files. So I don't know hehe. I think it must be because it is an android version.
 

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,855
6,379
but the version here on the site also comes with .rpyc files. So I don't know hehe. I think it must be because it is an android version.
Well, you got that right, it is because it's Android.
But even Android versions can compile rpy files, as far as I know. Although only recent versions of Ren'Py Android versions can be patched - not the apk's, but they create a game folder structure on the memory card, so new files and patches can be added there.
Dreams of Desire is just too old to be able to do that and you can not simply patch an Android apk

one does not simply patch an android app.jpg

apk is just a zip, but there is a list file in it that contains a name and hash of every file that apk contains. If I remember correctly, that hash is also Base64 encoded and the whole zip container is digitally signed.
To patch it with a new or modified file, you would have to extract the apk, hash the new file, Base64 encode the hash, modify the list file by adding the new file with the encoded hash to it or replace the old hash with modified one and after zipping it up again, sign it.

So I can give you a compiled file of my patch, but it probably won't help you anyway. It may not even run on Dreams of Desire, since it's compiled with the latest version of Ren'Py

A simpler way would be to build a new Android version on a PC with the help of the Ren'Py SDK and add my patch to it before compiling and building an apk. Or try to use the newest Ren'Py SDK to build a new Android version and add my patch to it later into the game folder on the mem card.

I really haven't made a single Android port of a Ren'Py game, so I don't know if that would actually work.
 
  • Red Heart
Reactions: PAlNMON

PAlNMON

Newbie
Aug 16, 2020
15
9
Well, you got that right, it is because it's Android.
But even Android versions can compile rpy files, as far as I know. Although only recent versions of Ren'Py Android versions can be patched - not the apk's, but they create a game folder structure on the memory card, so new files and patches can be added there.
Dreams of Desire is just too old to be able to do that and you can not simply patch an Android apk

View attachment 826799

apk is just a zip, but there is a list file in it that contains a name and hash of every file that apk contains. If I remember correctly, that hash is also Base64 encoded and the whole zip container is digitally signed.
To patch it with a new or modified file, you would have to extract the apk, hash the new file, Base64 encode the hash, modify the list file by adding the new file with the encoded hash to it or replace the old hash with modified one and after zipping it up again, sign it.

So I can give you a compiled file of my patch, but it probably won't help you anyway. It may not even run on Dreams of Desire, since it's compiled with the latest version of Ren'Py

A simpler way would be to build a new Android version on a PC with the help of the Ren'Py SDK and add my patch to it before compiling and building an apk. Or try to use the newest Ren'Py SDK to build a new Android version and add my patch to it later into the game folder on the mem card.

I really haven't made a single Android port of a Ren'Py game, so I don't know if that would actually work.
Man, I understand. Good to know! haha It's complicated in the short time I have. But I will joke after remaking APK, who knows maybe these procedures will not work. I will test the file here! But if it doesn't work, patience. Anyway, thanks for the expensive effort! Hugs :cool:(y)
 

KrystofDayne

Member
Donor
Dec 9, 2019
385
1,152
Man, I'm so glad this tool exists and so mad at myself for not bothering looking for something like this before now :ROFLMAO: the Ren'Py text boxes obscuring the lower thirds of the screen is such a pet peeve of mine. In many cases, that's also exactly the part of the screen that depicts the genitals, so that's extra frustrating ^^' so yeah, thanks a million for this, have had no problems with it so far.

I wonder though, there is still one slight aesthetic issue that remains; mostly, if you take away the text box, the text itself seems too high up onscreen. Do you think it's possible to modify this tool so that you can lower the text, so that it's not like a third up from the bottom?
 
  • Like
Reactions: Edrick23

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
9,944
14,546
[...] it took me only maybe 20 or 30 minutes to find - exactly what I've been looking for.
You should be able to also use it to change the color and/or add outlines in order to keep the name/text visible when the dialbox is removed.
 

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,855
6,379
You should be able to also use it to change the color and/or add outlines in order to keep the name/text visible when the dialbox is removed.
Yes, color and outlines are the two main keyword arguments I was planning to use it for. Positional arguments are rarely added to the character definitions, although I've seen it at least once. In one case there was a custom dialog box background added as a keyword argument - the same one to all characters, of course.

Unfortunately I've had no time nor energy to work on my patch lately. My day job has been keeping me too busy to be able to concentrate on anything about as complicated at home.
 
  • Like
Reactions: Walter Victor

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
9,944
14,546
Unfortunately I've had no time nor energy to work on my patch lately. My day job has been keeping me too busy to be able to concentrate on anything about as complicated at home.
I deeply understand you.

If you want, here's a code derived from something I use. It create an outline value on the fly, according to the actually used color :
Python:
# Split the color by component, and translate it into an integer.
# In #RGB format, the value are usually doubled.
if len( colorAsString ) == 4:
    # Red component.
    r = int( colorAsString[1] + colorAsString[1], 16 )
    # Green component.
    g = int( colorAsString[2] + colorAsString[2], 16 )
    # Blue component.
    b = int( colorAsString[3] + colorAsString[3], 16 )
    # No alpha channel in this format, which mean full opacity.
    a = 255
# #RRGGBB format.
elif len( colorAsString ) == 7:
    r = int( colorAsString[1,3], 16 )
    g = int( colorAsString[3,5], 16 )
    b = int( colorAsString[5,7], 16 )
    # Still no alpha channel.
    a = 255
# #RRGGBBAA format.
elif len( colorAsString ) == 9:
    r = int( colorAsString[1,3], 16 )
    g = int( colorAsString[3,5], 16 )
    b = int( colorAsString[5,7], 16 )
    a = int( colorAsString[7,9], 16 )
# I don't remember Ren'py supporting another format.
else:
    renpy.notify( "Oops" )
    return

# Now invert the red component
r = 255 - r
# Then adjust it when the result is too close from the initial color.
if 100 < r < 160:
    r = 0 if r > 127 else 255
# Green component
g = 255 - g
if 100 < g < 160:
    g = 0 if g > 127 else 255
# Blue component
b = 255 - b
if 100 < b < 160:
    b = 0 if b > 127 else 255
# Alpha channel probably don't need to be changed.

# Then create the outline value, building the color according of the computed values.
outlineValue = [ ( 2, "#{:02X}{:02X}{:02X}{:02X}".format( r,g,b,a ), 0, 0 ) ]
So far, it always gave me an outline color far enough from the text color to effectively increase the readability.
 
Sep 18, 2018
232
614
Encountered a problem with the latest version, that does not happen when i use the 2.4.12 version.
When playing MurMur, and using the Walkthrough mod/cheat.
The cheat button wont show, and all the base menu's end up on the far left of the screen, instead of the middle.

The Walkthrough mod/cheat, adds a extra button to the bottom standard buttons, but that does not show up in the 2.6.3 version.
Works with old so its fine.
But thought id report it.
 

Abhai

Devoted Member
Sep 12, 2018
8,329
35,384
Hi, Penfold Mole , I firstly want to say that I LOVE this mod. Really hard to play a game without it.

I was wondering if there was a way to remove the textboxes around the names in https://f95zone.to/threads/research-into-affection-v0-6-11-boomatica-jd.15780/?

Some instructions, or a patch for your mod, would be greatly appreciated. Thanks!

View attachment 936907
checked it on 0.6.2v i have (havent played it for a while).
perhaps the easiest way - just open screens.rpy, delete lines 101-102 (calling NameBox.png), and if he havent changed gui much that should fix it.
 
5.00 star(s) 6 Votes