Unlockable Imagebuttons via persistent data?

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
Geckos
Veteran
Posts: 471
Joined: Fri Aug 17, 2012 8:33 am
Completed: Brilliant Shadows, Perceptions of the Dead, The Phantom Icecream Truck
Projects: Embers of Magic, Pale Spectrum, Perceptions of the Dead
Organization: Ithaqua Labs
Tumblr: geckosart
Deviantart: sitaart
Contact:

Unlockable Imagebuttons via persistent data?

#1 Post by Geckos »

I'm working on creating an end-game visual map of the branches of my story. I was going to have a small image unlock upon each ending completion. Is there a way to hide an imagebutton until it's been unlocked?

Code: Select all

    imagebutton auto "sprites/star/star1_1%s.png" xpos 305 ypos 172 focus_mask None action NullAction() hovered [ Play ("sound", "sfx/cast.ogg"), Show("gui_tooltip", my_picture="ui/changes.png", my_tt_xpos=46, my_tt_ypos=648) ] unhovered [Hide("gui_tooltip")]
Image ImageImage

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Unlockable Imagebuttons via persistent data?

#2 Post by RicharDann »

Um... an if statement wouldn't work?

Code: Select all

if persistent.ending_1_unlocked:
    imagebutton auto "sprites/star/star1_1%s.png" xpos 305 ypos 172 focus_mask None action NullAction() hovered [ Play ("sound", "sfx/cast.ogg"), Show("gui_tooltip", my_picture="ui/changes.png", my_tt_xpos=46, my_tt_ypos=648) ] unhovered [Hide("gui_tooltip")]
The most important step is always the next one.

User avatar
Geckos
Veteran
Posts: 471
Joined: Fri Aug 17, 2012 8:33 am
Completed: Brilliant Shadows, Perceptions of the Dead, The Phantom Icecream Truck
Projects: Embers of Magic, Pale Spectrum, Perceptions of the Dead
Organization: Ithaqua Labs
Tumblr: geckosart
Deviantart: sitaart
Contact:

Re: Unlockable Imagebuttons via persistent data? (SOLVED)

#3 Post by Geckos »

You're right! I wasn't sure of the syntax, as I've never used persistent before and googling around didn't show that order. Thanks so much! :D
RicharDann wrote: Tue Sep 26, 2017 10:19 am Um... an if statement wouldn't work?

Code: Select all

if persistent.ending_1_unlocked:
    imagebutton auto "sprites/star/star1_1%s.png" xpos 305 ypos 172 focus_mask None action NullAction() hovered [ Play ("sound", "sfx/cast.ogg"), Show("gui_tooltip", my_picture="ui/changes.png", my_tt_xpos=46, my_tt_ypos=648) ] unhovered [Hide("gui_tooltip")]
[/quote]
Image ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users