You want to get the value then display the image which can be done without added if statements.
Most authors will code some sort of class system.
I typed this up and decided it was lame and annoying to explain so instead…
You would do something like this:
if connie_relationship >= 1:
$ connie.mood = "normal"
else:
$ connie.mood = "shy"
then elsewhere in the code when needed run.
$connie_path = str("/images/Sprites/connie/" + connie.mood + ".png")
then when you need to show connie you would just use
show connie at right
now uh, this might seem like just as much work… but what I’m trying to explain is that… you type the if once, in some sort of npc class setup file and then when needed you can just call the npc’s show function which will run the if and set the correct file for show… essentially you only have to type the if statement once, even if you need to use it 100s of times.
edit:
okay so here’s a rough attempt at creating some sort of connie class (although it might be better to define an npc class of which connie is just one of many).
class connie(object):
def __init__(self, identity):
self.mood = "shy"
self.relationship = 0
self.i = identity
def image(self):
if connie_relationship >= 1:
$ connie.mood = "normal"
else:
$ connie.mood = "shy"
return str("/images/Sprites/connie/" +connie.mood + ".png")
then when you want to show connie you could use
$ connie_path = connie.image()
show connie at right
So, the reason you need an if statement is NOT to display the image, you need the if statement to convert 0 into “shy” and 1 into “normal”
Although if the shy normal relationship is binary like that you could just use something like false/true or 0/1 and set the filenames to instead of using the words shy and normal just use false/true or 0/1 in the filename. So, yeah, you don’t actually need an if statement to choose the right file, but you do need an if statement to convert an integer into a word that’s a string.
another way to approach it I suppose would be this:
set up
label ShowConnie(int tempCR):
if tempCR >= 1:
show connie normal m at right
else:
show connie normal s at right
c"hi"
if tempCR >= 1:
show connie shy m
else:
show connie shy s
then in the body of the game in an event you’d run
ShowConnie(connie_relationship)
This way you only have to type ShowConnie(connie_relationship) over and over in the body of the game and it handles the if nonsense once elsewhere.
edit: Sorry this explanation really sucks, doesn’t it. Hopefully it’s better than nothing, if someone else writes a better explanation I can always delete mine.