Page 1 of 1

Changing images with outfits and gender

Posted: Sat Nov 18, 2017 1:09 pm
by SerpentEyes
I am trying to set up a system where not only does the character image shown change with gender selection, but with outfit worn. I didn't want to go into the complexities of composite images, since this isn't a dress-up game, just a bit of customization I want.

However, my image sets are static, and only go off default values no matter how much they are changed. Even when I put in choice threads, as I've seen suggested in other questions, it only goes to the default, not to the current setting. So:

Code: Select all

define gender = 0
define outfit = 0

image pov comms:
    choice(outfit == 0):
        choice(gender == 0):
            "pov_0_0_comms.png"
        choice(gender == 1):
            "pov_1_0_comms.png"
    choice(outfit == 1):
        choice(gender == 0):
            "pov_0_1_comms.png"
        choice(gender == 1):
            "pov_1_1_comms.png"
Always shows pov_0_0_comms.png no matter how the values change.

Code: Select all

show pov comms
Shows pov_0_0_comms.png, the default. But

Code: Select all

$ gender = 1
$ outfit = 1
show pov comms
Also shows pov_0_0_comms.png. I have checked the variables, and those are changing.

Ideally I'd want a more efficient way of doing this too, so I don't have to create massive choice loops for everything. I should be able to set up something like:

Code: Select all

Image("pov_%s_%s_comms.png" % (gender, outfit))
But all my efforts to do so have just returned the defaults. Tips on how to do this better would be appreciated.

Re: Changing images with outfits and gender

Posted: Sat Nov 18, 2017 1:35 pm
by Remix
image pov comms = DynamicImage( "pov_[gender]_[outfit]_comms.png" )
*might do it

DynamicImage
DynamicImage(name)

A DynamicImage is a displayable that has text interpolation performed on it to yield a string giving a new displayable. Such interpolation is performed at the start of each interaction.

Re: Changing images with outfits and gender

Posted: Sat Nov 18, 2017 2:31 pm
by SerpentEyes
That did it! Thanks so much.