Page 1 of 1

[Solved] Locking a Button / Screen

Posted: Fri Nov 08, 2019 5:50 pm
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

Re: Locking a Button / Screen

Posted: Fri Nov 08, 2019 9:14 pm
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.)
                            

Re: Locking a Button / Screen

Posted: Fri Nov 08, 2019 10:54 pm
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.