Page 1 of 1

[Solved]Using character side images with "show"

Posted: Thu Apr 06, 2017 8:34 am
by Nazon
I am trying to show character side image, according to the example.
https://www.renpy.org/doc/html/side_image.html

But it turns out, that I can't just use

Code: Select all

show eileen happy
in this case:

Code: Select all

define e = Character("Eileen", image="eileen")

image side eileen happy = "side_eileen_happy.png"
image side eileen = "side_eileen.png"

label start:

    show eileen happy

    e "Let's call this line Point A."
I've got a correct side image, but also placeholders instead of background. I do not need character sprites or something like this, just side image.

So, the question is:
how can I show and hide side images, without using command like:

Code: Select all

e happy "Hey, I am happy!"
but using something like:

Code: Select all

show side eileen happy
e "I am happy! Look on my side image!"
show side eileen sad
e "Now I am sad."

Re: Using character side images with "show"

Posted: Thu Apr 06, 2017 10:11 am
by indoneko
I'm not sure why you want to use manual method when you can automate it, but is there any chance that you're actually looking for invisible characters? It's similar to side image, but we don't display the character's sprite on the screen

Code: Select all

define p = Character("Player", image="player")

image side player happy = "side_player_happy.png"
image side player concerned = "side_player_concerned.png"

label start:

    p happy "This is shown with the 'side player happy' image."

    p "This is also shown with 'side player happy'."

    p concerned "This is shown with 'side player concerned'."

Re: Using character side images with "show"

Posted: Thu Apr 06, 2017 10:59 am
by Nazon
indoneko wrote:I'm not sure why you want to use manual method when you can automate it, but is there any chance that you're actually looking for invisible characters?
It's a long story. :)
Let's say, I just need to call side image independantly for a special reason. And not in the same line with the character saiying, if it is possible.
No, invisible character is slightly different, it's not what I mean.

Actually, I kinda find a way how to do it:

Code: Select all

define e = Character("Eileen", image="eileen")

image side eileen happy = "side_eileen_happy.png"
image eileen happy = Null()
image side eileen = "side_eileen.png"

label start:

    show eileen happy

    e "Let's call this line Point A."
If I explicitly initialize "image eileen happy" to Null(), renpy will show side image and blank background instead of placeholder.
But it would be too annoying to write Null() for every side image.
So, I am trying to find a way to keep it dry...

It is interesting, that blank side image refers to Null() image:

Code: Select all

define config.side_image_null = Null()
But I couldn't find the similar config line for other images, to replace placeholder with Null() by default.

Re: Using character side images with "show"

Posted: Fri Apr 07, 2017 10:33 am
by Saltome
Wait... I don't understand.
If you only wanna show a side image manually just go:

Code: Select all

show side eileen happy
Is that all you are trying to do?

Re: Using character side images with "show"

Posted: Sat Apr 08, 2017 2:13 pm
by Nazon
Saltome wrote:Wait... I don't understand.
If you only wanna show a side image manually just go:

Code: Select all

show side eileen happy
Is that all you are trying to do?
Yes, that's what I am trying to do.

After this:

Code: Select all

show side eileen happy
I've got the side image not in the say box, but as the character sprite.

Re: Using character side images with "show"

Posted: Sat Apr 08, 2017 2:44 pm
by Saltome
Am I the only one here who's confused?
Could you explain again what you are trying to achieve? In detail.

Re: Using character side images with "show"

Posted: Sat Apr 08, 2017 5:11 pm
by Nazon
Saltome wrote:Am I the only one here who's confused?
Could you explain again what you are trying to achieve? In detail.
I know, that it's confusing, but still...

I just need to manually show character side image not using the default syntax like:

Code: Select all

e happy "And this one is point B."
I'd like to use a separate command like

Code: Select all

show side eileen happy
that would just show the a side image in the say box(no character sprite or something else).

To put it simple, just calling a side image, using the separate command.

Re: Using character side images with "show"

Posted: Sun Apr 09, 2017 5:48 am
by Saltome
And I assume you don't want it to be shown in the middle of the text box. I'm actually not entirely sure why it does that.
Might be an issue with renpy. But before I start looking into code...
Why don't you do the obvious thing and create a normal image that uses the same graphic file like the side image? And use the show command on it instead.

Re: Using character side images with "show"

Posted: Sun Apr 09, 2017 7:41 am
by Nazon
Saltome wrote:And I assume you don't want it to be shown in the middle of the text box. I'm actually not entirely sure why it does that.
Might be an issue with renpy. But before I start looking into code...
Why don't you do the obvious thing and create a normal image that uses the same graphic file like the side image? And use the show command on it instead.
Well, because just using show command would not create a side image in the say box. The image would appear under the say box, as on the screenshot in my previous post.

Don't worry, I think I've found a workaround:

screen.py :

Code: Select all

## Say screen ##################################################################
##
## The say screen is used to display dialogue to the player. It takes two
## parameters, who and what, which are the name of the speaking character and
## the text to be displayed, respectively. (The who parameter can be None if no
## name is given.)
##
## This screen must create a text displayable with id "what", as Ren'Py uses
## this to manage text display. It can also create displayables with id "who"
## and id "window" to apply style properties.
##
## https://www.renpy.org/doc/html/screen_special.html#say
default additional_sideimg = None
init python:
    def AlternativeSideImage(new_side_image=None):
        if new_side_image is not None:
            additional_sideimg = new_side_image
        else:
            additional_sideimg = None
            return Null()
        
        return Image(additional_sideimg)

screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        text what id "what"

        if who is not None:

            window:
                style "namebox"
                text who id "who"

    # If there's a side image, display it above the text. Do not display
    # on the phone variant - there's no room.
    if not renpy.variant("small"):
        #add SideImage() xalign 0.0 yalign 1.0
        add AlternativeSideImage(additional_sideimg) xalign 0.0 yalign 1.0
I added AlternativeSideImage function and additional_sideimg.

script.py :

Code: Select all

define e = Character("Eileen", image="eileen")

image eileen happy = "eileen_happy.png"

label start:

    ## Show a background. This uses a placeholder by default, but you can add a
    ## file (named either "bg room.png" or "bg room.jpg") to the images
    ## directory to show it.

    scene bg room

    ## This shows a character sprite. A placeholder is used, but you can replace
    ## it by adding a file named "eileen happy.png" to the images directory.

    show eileen happy   
    ## These display lines of dialogue.

    "Hello, world."
    
    e "You've created a new Ren'Py game."
    
    $ additional_sideimg = "side_eileen_happy.png"
    
    e "Now I'm happy! Look at my side image!"
    
    $ additional_sideimg = None
    e "And now there is no side image!"
But in this way, the original SideImage() mechanism would be completely disabled.
I think I'd better use the old method.

Re: [Solved]Using character side images with "show"

Posted: Wed Mar 13, 2019 11:59 pm
by Godline
Hey guys! Bumping from the dead but I tried:
$ additional_sideimg = None

And now I don't know how to get the side image back again.
My problem is that with:

init python:
config.side_image_tag = "e"

I keep getting a side image popping up in NVL mode.

And I can't get:

define config.side_image_null = Null()

To work.

Little help?

Re: [Solved]Using character side images with "show"

Posted: Thu Mar 14, 2019 3:29 am
by Saltome
I can't really help you off the top of my head, sounds like you are having a number of separate issues.
Leaving this solution side, explain to me what effect exactly are you trying to achieve. And how is it different from Ren`py's normal behavior?