How do I use a condition switch on images?

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
User avatar
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

How do I use a condition switch on images?

#1 Post by GeeSeki »

I was to use a condition switch or an if statement, or something that makes it so that if wearingtie == '0', it won't display a tie. So far, it'll look for a tie0.png no matter what and that png doesn't exist. The code below is giving me a syntax error but it's probably the closest I can get on my own.

Code: Select all

$ wearinghat = '1'
$ wearingtie = '0'
$ wearingshoes = '1'

image newmember = Fixed(
"hat[wearinghat].png",
ConditionalSwitch(
'wearingtie' != '0', "tie[wearingtie].png"),
"shoes[wearingshoes].png")

## Images included are
## hat1.png
## tie1.png
## shoes1.png

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How do I use a condition switch on images?

#2 Post by Alex »

This should help - viewtopic.php?f=51&t=19063

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Sugar_and_rice, voluorem