[Solved]Using character side images with "show"

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
Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

[Solved]Using character side images with "show"

#1 Post by Nazon » Thu Apr 06, 2017 8:34 am

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."
Last edited by Nazon on Sun Apr 09, 2017 7:42 am, edited 1 time in total.

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Using character side images with "show"

#2 Post by indoneko » Thu Apr 06, 2017 10:11 am

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'."
My avatar is courtesy of Mellanthe

Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

Re: Using character side images with "show"

#3 Post by Nazon » Thu Apr 06, 2017 10:59 am

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.

User avatar
Saltome
Veteran
Posts: 231
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Using character side images with "show"

#4 Post by Saltome » Fri Apr 07, 2017 10:33 am

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?
Deviant Art: Image

Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

Re: Using character side images with "show"

#5 Post by Nazon » Sat Apr 08, 2017 2:13 pm

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.
Attachments
result.png

User avatar
Saltome
Veteran
Posts: 231
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Using character side images with "show"

#6 Post by Saltome » Sat Apr 08, 2017 2:44 pm

Am I the only one here who's confused?
Could you explain again what you are trying to achieve? In detail.
Deviant Art: Image

Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

Re: Using character side images with "show"

#7 Post by Nazon » Sat Apr 08, 2017 5:11 pm

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.

User avatar
Saltome
Veteran
Posts: 231
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Using character side images with "show"

#8 Post by Saltome » Sun Apr 09, 2017 5:48 am

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.
Deviant Art: Image

Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

Re: Using character side images with "show"

#9 Post by Nazon » Sun Apr 09, 2017 7:41 am

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.

User avatar
Godline
Veteran
Posts: 479
Joined: Fri Jun 27, 2014 12:26 am
Completed: numerous
Tumblr: godlinegames
Deviantart: godline-games
itch: godline
Contact:

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

#10 Post by Godline » Wed Mar 13, 2019 11:59 pm

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?

User avatar
Saltome
Veteran
Posts: 231
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

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

#11 Post by Saltome » Thu Mar 14, 2019 3:29 am

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?
Deviant Art: Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]