Asked to Overwrite Save on Load Screen? [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
Eirrir
Regular
Posts: 81
Joined: Mon Feb 27, 2017 7:16 pm
Projects: Operation: Future Domination
Tumblr: Eirrir
itch: eirrir
Contact:

Asked to Overwrite Save on Load Screen? [SOLVED]

#1 Post by Eirrir » Fri Nov 23, 2018 7:22 pm

Hello! This is my first time making a custom game menu screen to this extent, and unfortunately, I've run into an issue with the confirm (yes/no) prompt in save/load/delete screen. I've made different yes/no prompt images for saving, loading, and deleting files, but they don't show up accordingly. No matter whether I'm trying to save, load, or delete a save file, the only confirm message that pops up is "Do you want to overwrite the save?" Not only that, I can only overwrite saves. For example, even on the load file screen, I'm not able to load the actual save file, only overwrite it. I'm almost sure this is why only one confirm message pops up.

Can someone help me to make it so that yes/no prompts show up on the correct screen and executes the correct function (save, load, delete file)? Thanks for your time!

Code: Select all

screen file_slots(title):

    default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))

    use game_menu(title):

        fixed:

            ## This ensures the input will get the enter event before any of the
            ## buttons do.
            order_reverse True

            ## The page name, which can be edited by clicking on a button.
            button:
                style "page_label"

                key_events True
                xalign 0.5
                action page_name_value.Toggle()

                input:
                    style "page_label_text"
                    value page_name_value

            ## The grid of file slots.
            grid gui.file_slot_cols gui.file_slot_rows:
                style_prefix "slot"

                xalign 0.5
                yalign 0.5

                spacing gui.slot_spacing

                for i in range(gui.file_slot_cols * gui.file_slot_rows):

                    $ slot = i + 1

                    button:
                        action FileAction(slot)

                        has vbox

                        add FileScreenshot(slot) xalign 0.5

                        text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                            style "slot_time_text"

                        text FileSaveName(slot):
                            style "slot_name_text"

                        key "save_delete" action FileDelete(slot)

            ## Buttons to access other pages.
            hbox:
                style_prefix "page"

                xalign 0.5
                yalign 1.0

                spacing gui.page_spacing

                textbutton _("<") action FilePagePrevious()

                if config.has_autosave:
                    textbutton _("{#auto_page}A") action FilePage("auto")

                if config.has_quicksave:
                    textbutton _("{#quick_page}Q") action FilePage("quick")

                ## range(1, 10) gives the numbers from 1 to 9.
                for page in range(1, 10):
                    textbutton "[page]" action FilePage(page)

                textbutton _(">") action FilePageNext()

Code: Select all

screen load_save_slot:
    $ file_text = "% 2s. %s\n%s" % (
                        FileSlotName(number, 4),
                        FileTime(number, empty=_("Empty Slot")),
                        FileSaveName(number))

    add FileScreenshot(number) xpos 220 ypos 20
    text file_text xpos 0 ypos 10 size 40 color "#ffffff" outlines [ (2, "#302B54") ] kerning 2 font "fonts/Laborate.ttf"
    
    key "save_delete" action FileDelete(number)
Last edited by Eirrir on Sat Nov 24, 2018 7:47 pm, edited 4 times in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 2714
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Asked to Overwrite Save on Load Screen?

#2 Post by Imperf3kt » Sat Nov 24, 2018 7:29 am

You should take a look at the default file_slots screen, and compare with your edits - you aren't "using" any screen, so its probably only showing the save screen no matter what you try to get it to show.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Todo list:
Actually finish a project

User avatar
Eirrir
Regular
Posts: 81
Joined: Mon Feb 27, 2017 7:16 pm
Projects: Operation: Future Domination
Tumblr: Eirrir
itch: eirrir
Contact:

Re: Asked to Overwrite Save on Load Screen?

#3 Post by Eirrir » Sat Nov 24, 2018 6:30 pm

I tried using file_slots as suggested, for example, by adding use file_slots(_("Load")) to my load screen like this:

Code: Select all

screen load():

    tag menu
    #add "gui/savegame.png"
    use file_slots(_("Load")) #ADDED
    imagemap:

        alpha False
        auto "gui/load_%s.png"
        cache False

        hotspot (609, 147, 141, 30) action FilePage("auto")
        hotspot (609, 147, 141, 30) action FilePage("quick")
        hotspot (65, 210, 61, 59) action FilePagePrevious()
        hotspot (89, 275, 28, 37) clicked FilePage(1) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (91, 321, 24, 33) clicked FilePage(2) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (94, 364, 23, 32) clicked FilePage(3) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (91, 405, 29, 33) clicked FilePage(4) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (90, 445, 31, 39) clicked FilePage(5) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (95, 492, 25, 36) clicked FilePage(6) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (73, 535, 58, 58) action FilePageNext()

        hotspot (178, 221, 302, 183) clicked FileSave(1):
            use load_save_slot(number=1) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (516, 224, 292, 178) clicked FileSave(2):
            use load_save_slot(number=2) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"
        hotspot (858, 224, 293, 181) clicked FileSave(3):
            use load_save_slot(number=3) #activate_sound "sfx/click.wav" hover_sound "sfx/click.wav"

        #hotspot (0,0,0,0) action Return() activate_sound "FILE NAME HERE" hover_sound "FILE NAME HERE"
    use navigation
But it doesn't change anything, and I still have the same problem. I wonder if the problem lies in the "confirm" screen itself or my usage of both file_slots and save_load_slot?

User avatar
Eirrir
Regular
Posts: 81
Joined: Mon Feb 27, 2017 7:16 pm
Projects: Operation: Future Domination
Tumblr: Eirrir
itch: eirrir
Contact:

Re: Asked to Overwrite Save on Load Screen?

#4 Post by Eirrir » Sat Nov 24, 2018 7:47 pm

After some toiling, I managed to resolve the issue. Thanks for the help I've received!
Current VN Project:
Image
Game Development Blog

Post Reply

Who is online

Users browsing this forum: No registered users