AVNSnax wrote: ↑Tue Aug 23, 2022 3:54 pm
If I'm not mistaken, Ren'Py resolves the attributes for an image at compile time instead of runtime. It tries several methods to resolve an actual filename from the arguments given in the
show statement. In your example, Ren'Py is going to take your
v_season variable
name instead of its
value to derive an image name that doesn't exist.
The simplest solution is to mangle the image name yourself by calling
show's python equivalent,
renpy.show(), and pass it a string with the mangled image name + attributes.
Code: Select all
$ renpy.show("yui {} pout".format(v_season), ...)
This would work for your background images as well.
Is that something I would have to do when defining it only, or is that every single time I want to show any sort of image with a conditional attribute? I'm not sure whether I would need to fill out every single part of that (name, at_list, layer, what, zorder, tag, behind), either?
But I
would be able to use a variable in the string which is being used as the sprite's name?
Am I able to put in other attributes that would be included there, but AREN'T variables? That is, how would I use this to implement the following?
(Character name) (season variable) (outfit type) (expression)
Yui [season] casual pout
I'm sorry, I'm just really confused about how this actually works. Why is it that putting (v_season) directly after .format inserts it into the {} braces? In this case, would I just have to write out the entire rest of the file name (example, "yui {} casual pout".png(v_season), right)?
What layer would I use? How would I make sure that it operates as normal by showing it above the background? Using scene seems to get rid of all of the images being shown above it, unless I'm wrong, so how how do I replicate that without manually hiding it each time?
Would I actually have to manually hide each sprite after I use it and want to swap to a new one?
I'm sorry for so many questions, I just want to understand how this works and why. I don't see this information on the documentation listed, unless I've missed it somehow.