Show screen only if certain variable exists[SOLVED]

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
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Show screen only if certain variable exists[SOLVED]

#1 Post by TellerFarsight »

Code: Select all

textbutton l["place"] action [Show("location_photo", photo=l["photo"]), Show("icon_photo", icon=l["icon"]), Show("sub_location_list",actions=l["actions_list"])]

$ data = ["place":"Shinjuku", "photo":"shinjuku_photo", "icon":"shomonkai_icon", "actions_list":"list of actions"]
# The data for this last line might not be correct, I'm just pulling it from a larger nested structure and it's not important to my question I think.
I have this textbutton in my code that displays a photo, an icon, and a list of actions based on which location name the player clicks on. However, only some of the locations have an icon, and for the rest I want to just display the photo and list of actions.
Is there a way I can do this, maybe using if/then statements? I want to have conditions where no icon is shown.
Last edited by TellerFarsight on Sun Jun 25, 2017 11:19 am, edited 1 time in total.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Show screen only if certain variable exists

#2 Post by Alex »

Try to set icon as None in your data variable, so when it comes about showing this icon Ren'Py will show None...))

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Show screen only if certain variable exists

#3 Post by TellerFarsight »

Perfect. I had tried using null.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

Post Reply

Who is online

Users browsing this forum: No registered users