[Solved] Locking a Button / Screen

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
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

[Solved] Locking a Button / Screen

#1 Post by XxrenxX »

I've set up a simple "gloassary" in my game since I couldn't find anything that worked for what I wanted since it isn't going to be very large.
Anyway I want to lock buttons so they cannot be opened before a certain time in game. Preferably so it's open if and when they decide to go and do another pass through.

I have the buttons set up as so:

Code: Select all

vbox:
                button:
                    imagemap:
                        ground "GUI/Phone/Note_Frame.png"
                        hover "GUI/Phone/Note_Frame_H.png"
                        hotspot (0, 0, 365, 55) action ShowMenu("notes_example")
                        text "Entry 01" style "notes_button"
I thought I could use a simple True/False persistent but I'm not really sure how to go about doing this and since I can't do the search on these forums I limited to google which has been 0% helpful in figuring this out.


==================================================EDIT==================================================


I'm an idiot, it seems to work now that I've changed it from persistent.notes_example to persistent.notes_example_unlock and then just do an =True in script where needed. OTL
Last edited by XxrenxX on Sat Nov 09, 2019 10:38 pm, edited 2 times in total.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Locking a Button / Screen

#2 Post by isobellesophia »

XxrenxX wrote: Fri Nov 08, 2019 5:50 pm I've set up a simple "gloassary" in my game since I couldn't find anything that worked for what I wanted since it isn't going to be very large.
Anyway I want to lock buttons so they cannot be opened before a certain time in game. Preferably so it's open if and when they decide to go and do another pass through.

I have the buttons set up as so:

Code: Select all

vbox:
                button:
                    imagemap:
                        ground "GUI/Phone/Note_Frame.png"
                        hover "GUI/Phone/Note_Frame_H.png"
                        hotspot (0, 0, 365, 55) action ShowMenu("notes_example")
                        text "Entry 01" style "notes_button"
I thought I could use a simple True/False persistent but I'm not really sure how to go about doing this and since I can't do the search on these forums I limited to google which has been 0% helpful in figuring this out.

Im not really good at imagemaps, so you can try this if it is works.

Code: Select all

vbox:
                button:
                    imagemap:
                        if persistent.unlock:
                            ground "GUI/Phone/Note_Frame.png"
                            hover "GUI/Phone/Note_Frame_H.png"
                            hotspot (0, 0, 365, 55) action ShowMenu("notes_example")
                            text "Entry 01" style "notes_button"
                        else:
                            (Anything but a locked button with a text or etc.)
                            
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: Locking a Button / Screen

#3 Post by XxrenxX »

isobellesophia wrote: Fri Nov 08, 2019 9:14 pm Im not really good at imagemaps, so you can try this if it is works.

Code: Select all

vbox:
                button:
                    imagemap:
                        if persistent.unlock:
                            ground "GUI/Phone/Note_Frame.png"
                            hover "GUI/Phone/Note_Frame_H.png"
                            hotspot (0, 0, 365, 55) action ShowMenu("notes_example")
                            text "Entry 01" style "notes_button"
                        else:
                            (Anything but a locked button with a text or etc.)
                            
I have tried a few things since posting and where persistent does work, it doesn't keep the item globally unlocked. Even when loading a save file the item relocks itself. If using just persistent.unlock, how does the game know which one to unlock and when? I plan to use this for multiple entries not just the one.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]