about if-else structures

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
gremmie
Newbie
Posts: 2
Joined: Mon Jul 18, 2005 8:05 pm
Contact:

about if-else structures

#1 Post by gremmie »

It seems that the if structure can only be used with jump statements. I had a hard time figuring this out because I figured you could do just any old thing in there. The only thing that clued me in was the example in Rio's tutorial, which only has jump statements in it.

Could someone explain a little more about this?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#2 Post by PyTom »

No, if can be used with any statement. For example:

Code: Select all

if happy:
    "I'm happy."
else:
    "I'm not happy."
Should work.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: No registered users