Ren'Py Side Image

peterheimdall1979

New Member
Sep 19, 2017
5
0
Hi, i'm new at this, i'm trying to add side image to existing game (the tyrant).
I read renpy documents, and search how to do it in the internet...
I decompile the game and i found this

Init:
$ pov = Character("[pov]", color="ffffff", what_color="ffffff")
$ ls = Character("[ls]", color="#cc00ff", what_color="#cc00ff")
$ bs = Character("[bs]", color="007408", what_color="007408")
$ mother = Character("[mother]")
if p1 == False:
$ mom = Character("Mom", color="02a9ff", what_color="02a9ff")
else:
$ mom = Character("daniela")
$ father = Character("Bruce")
$ steve = Character("Steve", color="ffc600", what_color="ffc600")
$ davide = Character("Davide", color="00fcff", what_color="00fcff")
$ frank = Character("Frank", color="00fcff", what_color="00fcff")
if p1 == False:
$ dad = Character("Dad", color="ff0000", what_color="ff0000")
else:
$ dad = Character("Bruce")
$ martin = Character("Martin", color="ff0000", what_color="ffffff")
$ irina = Character("[irina]", color="cc00ff", what_color="cc00ff")
$ susan = Character("[susan]", color="cc00ff", what_color="cc00ff")
$ dummy = Character("Dummy", color="cc00ff", what_color="cc00ff")
$ kate = Character("[kate]", color="cc00ff", what_color="cc00ff")
$ vivian = Character("[vivian]", color="cc00ff", what_color="cc00ff")
$ miranda = Character("[miranda]", color="cc00ff", what_color="cc00ff")


So i write this script.

init python:
def return_str(str):
return str


define config.say_menu_text_filter = return_str


define ls = Character("[ls]", color="cc00ff", image = "ls", )
define mom = Character("[mother]", color="02a9ff", image = "mom", )
define irina = Character("[irina]", color="02a9ff", image = "irina", )



image side ls = "images/faces/side_ls.png"
image side mom = "images/faces/side_mom.png"
image side irina = "images/faces/side_irina.png"



The weird part is only works for the Mom image, and i can't make it work for the rest. What i doing wrong?, Someone can help me?.
Thanks in advance!.
 

SillyxRabbit

Newbie
Oct 13, 2016
69
113
It's because of their dynamic name. If you change it, it should show up.
define ls = Character("[littlesis]", color="cc00ff", image = "ls", )
define irina = Character("[ir]", color="02a9ff", image = "irina", )
 
  • Like
Reactions: 79flavors

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
Good catch.
I've been staring at that one and scratching my head.

But you're right... he's using the same variable name for the changeable name AND the actual character definition. So one would end up overriding the other.
Mom works because her changeable name variable is called "mother".

Though now I'm left wondering how The Tyrant actually still works.
 
  • Like
Reactions: JohnDupont

SillyxRabbit

Newbie
Oct 13, 2016
69
113
It works fine if the game is only using it for names in dialogue. Glancing through the code, it looks like the case.
 

peterheimdall1979

New Member
Sep 19, 2017
5
0
It's because of their dynamic name. If you change it, it should show up.
define ls = Character("[littlesis]", color="cc00ff", image = "ls", )
define irina = Character("[ir]", color="02a9ff", image = "irina", )
Thanks for the help, but it doesn't work, still doesn't show the side image.
I still don't understand why only show the mother image.
 

SillyxRabbit

Newbie
Oct 13, 2016
69
113
Below is exactly everything i changed:
in script.rpy:
$ ls = Character("[littlesis]",image = "ls")
$ irina = Character("[ir]", color="cc00ff", what_color="ffffff",image = "irina")

in intro.rpy:
if inc == True:
$ littlesis = renpy.input(_("So what's your little sister's name?")) or _("Alexis")
else:
$ littlesis = renpy.input(_("So what's your younger childhood friends name?")) or _("Alexis")

in living_room.rpy:
if irinafirstmeet == False:
$ ir = renpy.input(_("My name is...")) or _("Irina")
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,190
$ littlesis = renpy.input(_("So what's your little sister's name?")) or _("Alexis")
The have many parameters, among them you found "default" that is better than yout "or", since it show the name when the question is asked, letting to the player the possibility to keep it.
Code:
        $ littlesis = renpy.input(_("So what's your little sister's name?"), default="Alexis")
 
  • Like
Reactions: SillyxRabbit

SillyxRabbit

Newbie
Oct 13, 2016
69
113
The have many parameters, among them you found "default" that is better than yout "or", since it show the name when the question is asked, letting to the player the possibility to keep it.
Code:
        $ littlesis = renpy.input(_("So what's your little sister's name?"), default="Alexis")
You're right on that. I saw that before, I didn't bother changing it because it wasn't really related to the issue with side images. I kept it as close to what's originally was in The Tyrant script.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,190
I kept it as close to what's originally was in The Tyrant script.
Not to be harsh or disrespectful with some devs, but staying too close to the code of this game isn't necessarily a good idea.
I see people saying "to learn, look at what the other do", which isn't false and I said it myself more than once. But personally I also add, "but don't limit to one game, look many of them".
The problem is that many games are made by people who aren't coders. So, they do it "like it seem to work". By looking at more than one game, you'll learn more, way more. Not only because you'll have different sources of knowledge, but mostly because you'll see "this", and "that", and in your mind will come something like, "wait, what if I do this and that together ?". In the end, the knowledge you'll acquire will be more than the sum of the knowledge of the guys who wrote the code you used to learn.
I understand why you want to stay as close as possible to the original, it's reassuring. You know that "this" works. But we learn more from our errors than from everything else ; especially the success of others. So, keep the original, but comment it, something like :
Code:
#        $ littlesis = renpy.input(_("So what's your little sister's name?")) or _("Alexis") 
        $ littlesis = renpy.input(_("So what's your little sister's name?"), default="Alexis")
This way, at anytime you can revert to what works, will still trying to figure by yourself a better way to do it, or at least a way nearer to what yourself effectively want to do. So, in short, you'll learn more.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
Okay... a more complete answer...

The Tyrant isn't doing it right.

Initially, it defines a variable like "pov"
Ignoring (*bahh*, *hiss*, *mumble*, *grumble*) the fact that it should be a define, not a $ variable....

Python:
    $ pov = Character("[pov]", color="ffffff", what_color="ffffff", image = "player")
That's fine. At this point, side images are still working fine.

But as you start the game, it asks you your name.
Python:
    $ pov = renpy.input(_("So what is your first name?")) or _("Sam")

That completely replaces the character definition with a simple string like "Sam" or "Boris".
RenPy doesn't care. It figures it out and just carries on, using lines like...
Python:
    pov "{i}I was asleep?{/i}"
-and-
    mom "Oh, good morning [pov]! Did you sleep well in your new home?"

But pov is no longer a Character, it's a simple string and strings don't have side images.
You may not have noticed, but the colors defined originally don't work either. They go back to the default blue.

Mother works, because her Character definition is called "mom" and the variable used to store her name is called "mother". Though a more accurate answer is that there isn't a renpy.input line anywhere completely overwriting the original definition.

The only way I can think to fix this properly without breaking save files would be to rename all the Character definitions for any character where their character uses a variable that conflicts. So something like...
Change all " pov " to " mc "
Change all " ls " to " lsis "
Change all " bs " to " bsis "
Change all " vivian " to " vi "
Change all " kate " to " ka "
Change all " irina " to " ir "
Change all " miranda " to " mi "
Change all " susan " to " su "
make sure you use "case sensitive" changes, so it doesn't change data that aren't variable names.
... then go and fix all the renpy.input lines that are now wrong.

That way, when you load a save game where "Susan = u'Susan'", it doesn't break the character definition.

All that said, it would require practically every line of code in The Tyrant changing to match. A good editor will do that for you in no time at all. But then you'd have to do all this again next time The Tyrant is updated. Unless you can convince the author to change his version to fix the underlying cause.

I'm attaching a version of 0.6 source code I got working with sides here. But it'll only last as long as it takes for 0.7 to come out. It doesn't include the side images you'll need.
I didn't extensively test it. I may have screwed something up.

To anyone wondering what my "fix" looks like, but doesn't want to down the source code... it's basically this...
You don't have permission to view the spoiler content. Log in or register now.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
The have many parameters, among them you found "default" that is better than your "or", since it show the name when the question is asked, letting to the player the possibility to keep it.
Code:
        $ littlesis = renpy.input(_("So what's your little sister's name?"), default="Alexis")
As a complete side note...

I will say I dislike using default with renpy.input.
In theory it's a great idea. But it means you need to delete the default name before you type in the name you want.
Not a massive problem. It's just I'd rather type in the name straight away, without deleting what was there first.

I'd usually do this:
Python:
    python:
        pc_name = renpy.input("What is your name? {i}(Press ENTER to use the default name 'Glen'){/i}", length=20, exclude=" 0123456789+=,.?!<>{}[]'\"\%")
        pc_name = pc_name.strip()

        if not pc_name:
            pc_name = "Glen"

But merging the two ideas... I guess... this would work too...
Python:
    $ ls = renpy.input(_("So what's your little sister's name?" {i}(Just press ENTER for 'Alexis'){/i}"), length=20, exclude=" 0123456789+=,.?!<>{}[]'\"\%")
    $ ls = ls.strip() or _("Alexis")
 

JohnDupont

Active Member
Modder
May 26, 2017
838
2,810
I will say I dislike using default with renpy.input.
In theory it's a great idea. But it means you need to delete the default name before you type in the name you want.
Agreed. Letting the player change a character's name is supposed to give them more liberty or control, not force them to press backspace multiple times.
 

peterheimdall1979

New Member
Sep 19, 2017
5
0
Okay... a more complete answer...

But pov is no longer a Character, it's a simple string and strings don't have side images.
You may not have noticed, but the colors defined originally don't work either. They go back to the default blue..
Yes i notice that with the colors, in fact the only characters that side image works are the only with colors works too.
Mother and male characters.
I notice that all male characters are different than the female.

Female
$ bs = Character("[bs]", color="007408", what_color="007408")

Male
$ frank = Character("Frank", color="00fcff", what_color="00fcff")

The first letter in all male characters are in capital
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
The first letter in all male characters are in capital
Whilst true, that's a distraction.
The only reason it works for the male characters is that the author wanted more customization options for the females. That customization broke side images.

If you look at the draft version I sent you via PM while I was still messing about... you'll see that I changed the code so that you could (in theory) change the name of the dad too. Instead of "Bruce", I used "[dad_name]" - but didn't add a corresponding renpy.input to match.

The core problem with The Tyrant, and by association the problem you're having with side images for it is that it creates a character definition and then immediately overwrites it with something else that works, but is incompatible with side images (and colors). If you use different names for the character and the character name... it wouldn't break.

If you're only interested in playing the game with side images, just download within this thread to overwrite the ones in your game folder and play.

If you're interested in how side images work, maybe pick a different game to try it out on. Or again, download the attachment and add side images to the other characters... maybe even do the whole "type in the dad's name" change I was talking about too (which I didn't do to this attached version). Just to get a feel for things.

The reality is you just got unlucky by picking The Tyrant.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,190
As a complete side note...

I will say I dislike using default with renpy.input.
Yeah, it should erase the whole default value once the player press a key.


The core problem with The Tyrant, and by association the problem you're having with side images for it is that it creates a character definition and then immediately overwrites it with something else that works, but is incompatible with side images (and colors). If you use different names for the character and the character name... it wouldn't break.
Well, what timing, I talked more on depth two days ago. Side image isn't the only problem that will be raised, and at least this one don't lead to a crash.