show_side_image

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
chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

show_side_image

#1 Post by chronoluminaire »

Hi all. I'm just venturing into the world of show_side_image for the first time, and discovering a couple of questions...

1) Am I right in thinking that there's no automatic way to connect the image shown on the side with the character's image as displayed? I.e., in the simplest case if the script looks like this, there's no way to make the side image be "happy" for the first line and "sad" for the second?

Code: Select all

show e happy
e "Some happy thoughts"
show e sad
e "Some sadder thoughts"
This seems like the most natural way that people will want to use show_side_image, and the way that most commercial VNs with a side_image have it work: it always matches the character's image as shown on screen. So I'm a bit surprised if there's no way to make that work automatically.

2) Assuming this is the case... The only way around it I've thought of is using ConditionSwitch to define both the normal character image, and the show_side_image. So the script would look like:

Code: Select all

$ eileen_mood = "happy"
e "Some happy thoughts"
$ eileen_mood = "sad"
e "Some sadder thoughts"
Will this work?
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: show_side_image

#2 Post by PyTom »

You could consider using ShowingSwitch, which is meant for this.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

Re: show_side_image

#3 Post by chronoluminaire »

Aha - brilliant. Thanks. I'll add a crossref to ShowingSwitch from the wiki pages for show_side_image and the FAQ entry, if that's okay, because I had a look around on the wiki and didn't find any mention of this.
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: show_side_image

#4 Post by PyTom »

Sure. As a further trick, one can define images to be null:

Code: Select all

image eileen happy hidden = Null()
image eileen concerned hidden = Null()
By showing these null images, you can influence what the ShowingSwitch displays, even though it's not on the screen.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

Re: show_side_image

#5 Post by chronoluminaire »

Okay, updated the wiki pages.

I have a further question. I'm trying to assemble a fairly complex ShowingSwitch. As is the normal use of ShowingSwitch, I want to just have a cropped version of whatever image is showing. The character's got quite a lot of expressions, each assembled at init time as an im.Composite of quite a few parts. So I'd really rather not create merged images for the side_image version of each expression, given that Ren'Py's perfectly capable of assembling the main expressions using im.Composite.

So I thought I ought to be able to assemble the big ShowingSwitch from im.Crop. However, neither way I tried to do it worked.

If I try this:

Code: Select all

    NadineSideImage = im.Crop(
          ShowingSwitch(
            "Nadine happy"           ,"Nadine happy"           ,
            "Nadine happytalk"       ,"Nadine happytalk"       ,
            "Nadine excited"         ,"Nadine excited"         ,
            "Nadine bliss"           ,"Nadine bliss"           ,
            "Nadine smug"            ,"Nadine smug"            ,
            "Nadine relieved"        ,"Nadine relieved"        ,
            "Nadine faintlysurprised","Nadine faintlysurprised",
            "Nadine startled"        ,"Nadine startled"        ,
            "Nadine shocked"         ,"Nadine shocked"         ,
            "Nadine vexed"           ,"Nadine vexed"           ,
            "Nadine grumpy"          ,"Nadine grumpy"          ,
            "Nadine pain"            ,"Nadine pain"            ,
            "Nadine dislike"         ,"Nadine dislike"         ,
            "Nadine angry"           ,"Nadine angry"           ,
            "Nadine worried"         ,"Nadine worried"         ,
            "Nadine neutral"         ,"Nadine neutral"         ,
            "Nadine bored"           ,"Nadine bored"           ,
            "Nadine shrug"           ,"Nadine shrug"           ,
            "Nadine curious"         ,"Nadine curious"         ,
            None, Null(),
            xalign=0.0, yalign=1.0),
          0, 0, 220, 160)
    Nadine = Character('Nadine', color="#d5cb6b",
        window_left_padding=240,
        show_side_image=NadineSideImage)
Then I get this error:

Code: Select all

Exception: Expected an image, but got a general displayable.

While executing init code:
 - script at line 138 of C:\My Documents\Creations\Ren'Py\renpy-6.10.1\Nadine test/game/Nadine_test.rpy
 - python at line 160 of C:\My Documents\Creations\Ren'Py\renpy-6.10.1\Nadine test/game/Nadine_test.rpy.
Whereas if I try this:

Code: Select all

init python:
    NadineSideImage = ShowingSwitch(
            "Nadine happy"           , im.Crop("Nadine happy"           , 0, 0, 220, 160),
            "Nadine happytalk"       , im.Crop("Nadine happytalk"       , 0, 0, 220, 160),
            "Nadine excited"         , im.Crop("Nadine excited"         , 0, 0, 220, 160),
            "Nadine bliss"           , im.Crop("Nadine bliss"           , 0, 0, 220, 160),
            "Nadine smug"            , im.Crop("Nadine smug"            , 0, 0, 220, 160),
            "Nadine relieved"        , im.Crop("Nadine relieved"        , 0, 0, 220, 160),
            "Nadine faintlysurprised", im.Crop("Nadine faintlysurprised", 0, 0, 220, 160),
            "Nadine startled"        , im.Crop("Nadine startled"        , 0, 0, 220, 160),
            "Nadine shocked"         , im.Crop("Nadine shocked"         , 0, 0, 220, 160),
            "Nadine vexed"           , im.Crop("Nadine vexed"           , 0, 0, 220, 160),
            "Nadine grumpy"          , im.Crop("Nadine grumpy"          , 0, 0, 220, 160),
            "Nadine pain"            , im.Crop("Nadine pain"            , 0, 0, 220, 160),
            "Nadine dislike"         , im.Crop("Nadine dislike"         , 0, 0, 220, 160),
            "Nadine angry"           , im.Crop("Nadine angry"           , 0, 0, 220, 160),
            "Nadine worried"         , im.Crop("Nadine worried"         , 0, 0, 220, 160),
            "Nadine neutral"         , im.Crop("Nadine neutral"         , 0, 0, 220, 160),
            "Nadine bored"           , im.Crop("Nadine bored"           , 0, 0, 220, 160),
            "Nadine shrug"           , im.Crop("Nadine shrug"           , 0, 0, 220, 160),
            "Nadine curious"         , im.Crop("Nadine curious"         , 0, 0, 220, 160),
            None, Null(),
            xalign=0.0, yalign=1.0)
    Nadine = Character('Nadine', color="#d5cb6b",
        window_left_padding=240,
        show_side_image=NadineSideImage)
Then I get this error:

Code: Select all

IOError: Couldn't find file 'Nadine happy'.

While running game code:
 - script at line 174 of C:\My Documents\Creations\Ren'Py\renpy-6.10.1\Nadine test/game/Nadine_test.rpy
That line is the first show statement in the program, "show Nadine happy at centre".

Both of these errors look like things are expecting images / image filenames, and aren't able to handle general displayables, which seems like a problem.


As a side issue, surely this is the main use of show_side_image and ShowingSwitch? I'd have thought I ought to be able to declare this without a big 20 line statement (for each character!), just as something like:

Code: Select all

    Nadine = Character('Nadine', color="#d5cb6b",
        window_left_padding=240,
        show_side_image=im.Crop(ShowingImage("Nadine"), 0, 0, 220, 160))
Perhaps this could be a feature suggestion for a future Ren'Py version? It seems like by far the most common thing to want to do with both these functions.
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: show_side_image

#6 Post by PyTom »

Your best bet, with the first one, is to use LiveCrop instead of im.Crop. I'll consider adding a ShowingImage at some point.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

Re: show_side_image

#7 Post by chronoluminaire »

Aha, thank you. That works. (I had to grep the Ren'Py source code for LiveCrop, because its documentation appears to have been entirely removed when ATL came in - either that or it was never documented at all. So I had to read the source to figure out the call syntax. But when I'd done that, it worked fine ^^;; )
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!

Post Reply

Who is online

Users browsing this forum: munni, Ocelot