Characters and 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
choklitchan
Regular
Posts: 143
Joined: Sun Mar 13, 2011 12:28 am
Contact:

Characters and images

#1 Post by choklitchan » Sun Mar 13, 2011 12:43 am

I want to put a character side image in my game. I only need one character.
I read the conditional statement tutorial,
http://www.renpy.org/wiki/renpy/doc/coo ... ide_Images,
though I don't think I fully understand. Here's my code.

$ i = Character('Ivari',
color = "#c8ffc8",
window_left_padding=160,
show_side_image=ConditionSwitch(
"express = 'sleepy1'", "yivari_sleepy1.png",
"express = '1'", "yivari1.png",
"express = 'normal'", "yivari_normal.png",
"express = 'yell'", "yivari_yell",
"express = 'cry'", "yivary_cry.png",
"express = 'sad'", "yivari_sad.png",
"express = 'sleepy'", "yivari_sleepy2.png",
"express = 'happy'", "yivari_happy.png",
)
)
and try to express it later by this:

define express = "1"
q "Good night, sweetheart."
i "Good night, mother."

It stops running after q talks.

traceback.txt:
If I put the $ sign as the tutorial suggests, I receive
Exception: Sayer 'i' is not defined
If I put define, as I usually do with Characters, I receive
SyntaxError: invalid syntax (<none>, line 1)

What did I do wrong, and how can I fix it? I'm just starting out on Renpy, and I'm still unused to programming.
Can anyone help me, please? Thank you. ^_^
Finished:
Shrinkled
Mobile Food Madness (Polymorphic Games)
Works in Progress
The Truth of the Legends (Hiatus)

User avatar
pkt
Veteran
Posts: 322
Joined: Tue Jul 28, 2009 10:09 pm
Completed: I dunno
Projects: Something special
Contact:

Re: Characters and images

#2 Post by pkt » Sun Mar 13, 2011 7:03 pm

$ i = Character('Ivari', color = "#c8ffc8", window_left_padding=160,show_side_image=ConditionSwitch("express = 'sleepy1'", "yivari_sleepy1.png","express = '1'", "yivari1.png","express = 'normal'", "yivari_normal.png","express = 'yell'", "yivari_yell","express = 'cry'", "yivary_cry.png","express = 'sad'", "yivari_sad.png","express = 'sleepy'", "yivari_sleepy2.png","express = 'happy'", "yivari_happy.png",))

This is one solution to the first problem which is the indentation of a multiline statement. Those things can be tricky and they won't work out right unless you have the proper indentation but if you put it all on one line then you can avoid that though this isn't the solution to every problem. I placed it all on one line which should solve the problem. And here's the fix for the calling statement...

$ express = "1"
q "Good night, sweetheart."
i "Good night, mother."
No Active Public Renpy Projects...

User avatar
choklitchan
Regular
Posts: 143
Joined: Sun Mar 13, 2011 12:28 am
Contact:

Re: Characters and images

#3 Post by choklitchan » Sun Mar 13, 2011 8:53 pm

thanks, pkt! :)
Finished:
Shrinkled
Mobile Food Madness (Polymorphic Games)
Works in Progress
The Truth of the Legends (Hiatus)

Post Reply

Who is online

Users browsing this forum: _ticlock_