Show an image If a boolean is False.

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
johandark
Veteran
Posts: 356
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Show an image If a boolean is False.

#1 Post by johandark »

Code: Select all

    show afternoon01_Bathroom DidacBeated with dissolve (if $ afternoon01_NotPunchDidac == False):
I want to show an image with dissolve if a "Boolean" called "afternoon01_NotPunchDidac" i esqual False...

This sentence give me an error... Wich is the correct way to do it?
Image

User avatar
Iylae
Regular
Posts: 73
Joined: Sat Jan 09, 2016 6:57 am
Location: Cornwall, UK
Contact:

Re: Show an image If a boolean is False.

#2 Post by Iylae »

Not entirely sure whether you want to show the image but not with dissolve if the variable is set to true so... if you want only the dissolve part to be controlled by the variable:

Code: Select all

if afternoon01_NotPunchDidac:    # (is equal to True)
    show afternoon01_Bathroom DidacBeated
else:                            # (is not equal to True)
    show afternoon01_Bathroom DidacBeated with dissolve
If you don't want to show anything if it's true:

Code: Select all

if (afternoon01_NotPunchDidac == False):
    show afternoon01_Bathroom DidacBeated with dissolve
Image
  If we are what we repeatedly do, then good coding is not an act, but a habit

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Show an image If a boolean is False.

#3 Post by papiersam »

Or, you could use:

Code: Select all

if not afternoon01_NotPunchDidac:
    show afternoon01_Bathroom DidacBeated with dissolve
I've always preferred to use logical connectives when I could. It works with integers as well as boolean.

Post Reply

Who is online

Users browsing this forum: No registered users