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.