Conditional staements for Image Buttons

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
Bnig98JR
Newbie
Posts: 3
Joined: Tue Aug 31, 2021 5:38 am
Contact:

Conditional staements for Image Buttons

#1 Post by Bnig98JR »

How would i go about making a screen that will display a certain image button only if a condition has been fulfilled? I'm trying to make an inventory screen where if a certain flag is raised an image will be shown, otherwise it is blank.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Conditional staements for Image Buttons

#2 Post by Ocelot »

If you need button to appear only if certain condition is satisfied, it is straightforward:

Code: Select all

screen inv():
    if certain_condition:
        imagemutton <...>
< < insert Rick Cook quote here > >

Bnig98JR
Newbie
Posts: 3
Joined: Tue Aug 31, 2021 5:38 am
Contact:

Re: Conditional staements for Image Buttons

#3 Post by Bnig98JR »

Ocelot wrote: Sat Sep 04, 2021 4:52 pm If you need button to appear only if certain condition is satisfied, it is straightforward:

Code: Select all

screen inv():
    if certain_condition:
        imagemutton <...>
Got it, works perfectly, thank you!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], crowcinthus, Yahoo [Bot]