Real "Delete" Button. At Save Menu.

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Real "Delete" Button. At Save Menu.

#1 Post by dyrarendy » Thu Apr 03, 2014 12:37 pm

Well, I didn't see someone use "Delete" button for Delete Saving Game Data.
Or ... Correct me if im wrong. and sorry.

Whatever, i add a button code for "Delete" that can Help "User" delete data and free up spaces.
Without do "Overwrites".

Its Just a Simple Logics, and .. its really simple.

This code from my game :

Code: Select all

##############################################################################
# Save, Load
#

screen file_picker :
       
    $ config.thumbnail_height  = 480
    $ config.thumbnail_width = 700

    default current_file = 0
    if current_file != 0:
        add FileScreenshot(current_file) xalign 0.15 yalign 0.30

    frame:
        area (850, 45, 400, 600)
        style "file_picker_frame"
        viewport:
            scrollbars "vertical"
            mousewheel True
            has vbox
            $ rows = 10
            # Display fifty file slots, numbered 1 - 10.
            for i in range(1, rows + 1):

              if delete == True :
                    button:
                            action FileDelete(i)
                            hovered SetScreenVariable("current_file", i)
                            unhovered SetScreenVariable("current_file", 0)
                            xfill True
                            has hbox
                            $ file_name = FileSlotName(i, rows)
                            $ file_time = FileTime(i, empty=_("{color=#00FF00}Kosong{/color}"))
                            text "=================================={vspace=3}File no : [file_name]{vspace=3}{space=145}[file_time!t]{vspace=3}=================================="

              else :
                    button:
                            action FileAction(i)
                            hovered SetScreenVariable("current_file", i)
                            unhovered SetScreenVariable("current_file", 0)
                            xfill True
                            has hbox
                            $ file_name = FileSlotName(i, rows)
                            $ file_time = FileTime(i, empty=_("{space=147}{color=#00FF00}Kosong{/color}"))
                            text "=================================={vspace=3}File no : [file_name]{vspace=3}{space=145}[file_time!t]{vspace=3}=================================="
                            key "save_delete" action FileDelete(i)

screen save:

    # This ensures that any other menu screen is replaced.
    tag menu
    $ delete = False
    use navigationsave
    use file_picker

screen load:

    # This ensures that any other menu screen is replaced.
    tag menu
    $ delete = False
    use navigationsave
    use file_picker

screen delete:

    # This ensures that any other menu screen is replaced.
    tag menu
    $ delete = True
    use navigationsave
    use file_picker

init -2:
    style file_picker_frame is menu_frame
    style file_picker_nav_button is small_button
    style file_picker_nav_button_text is small_button_text
    style file_picker_button is large_button
    style file_picker_text is large_button_text
The Menu :

Code: Select all

screen navigationsave:

    # The background of the game menu.
    window:
        style "gm_root"

    # The various buttons.
    frame:
        style_group "gm_nav"
        xalign .22
        yalign .94
        has vbox
        textbutton _("{size=+5}Manual{/size}") action FilePage(1)
        textbutton _("{size=+5}Automatic{/size}") action FilePage("auto")
        textbutton _("{size=+5}Back{/size}") action Return()
    frame:
        style_group "gm_nav"
        xalign .37
        yalign .94
        has vbox
        textbutton _("{size=+5}Save{/size}") action ShowMenu("save")
        textbutton _("{size=+5}Continue{/size}") action ShowMenu("load")
        textbutton _("{size=+5}Delete{/size}") action ShowMenu("delete")
    frame:
        xalign .96
        yalign .96
        has hbox
        textbutton _("◄"):
              action FilePagePrevious()

        for i in range(1, 8):
              textbutton str(i):
                    action FilePage(i)

        textbutton _("►"):
              action FilePageNext()

init -2:
    # Make all game menu navigation buttons the same size.
    style gm_nav_button:
        size_group "gm_nav"
U can use menu navigation, or create new menu like me "navigationsave".


The "Key" :

Code: Select all

action FileDelete(i)
Well, try this.

Oh yes, Ignore this code :
( its just a style )

Code: Select all

==================================

And, If u try to delete and then pop up menu like :
"Are you sure wanna quit ?"
(Y) U will delete file save
(N) No action tough.

Actually, Its because :

Code: Select all

screen yesno_prompt:
Solution is U Must Edit "screen yesno_prompt"
( Example : I'm replacing "Are you sure wanna quit ?" with "Are you sure ?". )

Oh, one left..
You Can delete All Saves Games, From All Pages include Automatic Save Pages, and Quick Save Pages.
Attachments
before delete.jpg
Before Delete
after delete.jpg
After Deleted
My Project :
Image

User avatar
tiya_nofurita
Miko-Class Veteran
Posts: 669
Joined: Fri Jun 22, 2012 7:23 pm
Completed: ALLBLACK Phase 1, Heart's Blight, Last Rx., EDDA Cafe, Kohana, Half Moon
Projects: ALLBLACK Phase 2
Organization: VN Project Indonesia
Deviantart: SECONDARY-TARGET
itch: NSAID
Location: I can be everywhere
Discord: 3,4-Methylendioxymethamphetamine#4886
Contact:

Re: Real "Delete" Button. At Save Menu.

#2 Post by tiya_nofurita » Fri Apr 04, 2014 8:42 am

Hey thanks, it doesn't work perfectly as I blindly copy paste your code but after several attempts fixed the errors manually (mostly because wrong indentation), it works :D. Maybe I'm going to messing around with imagemaps next.
saveloadscreenattempt.png
Webtoon

"For what reason I live?"
Image

---
Completed project:


"What will you see when you are dead?"

Image

MY VISUAL NOVEL

User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Re: Real "Delete" Button. At Save Menu.

#3 Post by dyrarendy » Fri Apr 04, 2014 10:16 am

The wrong indentation is because "spacing" or "tabs"

Nice one... keep it up.
My Project :
Image

User avatar
tiya_nofurita
Miko-Class Veteran
Posts: 669
Joined: Fri Jun 22, 2012 7:23 pm
Completed: ALLBLACK Phase 1, Heart's Blight, Last Rx., EDDA Cafe, Kohana, Half Moon
Projects: ALLBLACK Phase 2
Organization: VN Project Indonesia
Deviantart: SECONDARY-TARGET
itch: NSAID
Location: I can be everywhere
Discord: 3,4-Methylendioxymethamphetamine#4886
Contact:

Re: Real "Delete" Button. At Save Menu.

#4 Post by tiya_nofurita » Sat Apr 05, 2014 8:11 am

Yay successfully implement with Imagemap.
Thank you once again!
screenshot0003.png
Webtoon

"For what reason I live?"
Image

---
Completed project:


"What will you see when you are dead?"

Image

MY VISUAL NOVEL

User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Re: Real "Delete" Button. At Save Menu.

#5 Post by dyrarendy » Thu Apr 10, 2014 4:14 am

that was nice imagemaps.. 8)
My Project :
Image

User avatar
Galaxious
Newbie
Posts: 12
Joined: Fri Oct 03, 2014 11:01 am
Projects: RED
Tumblr: kouhsitxt
Deviantart: donutaki
Soundcloud: sasowis
Location: Philippines
Contact:

Re: Real "Delete" Button. At Save Menu.

#6 Post by Galaxious » Sat Oct 04, 2014 11:36 am

This seriously worked. Oh my gosh, thank you so much!
* · ✦˚ + . ˚.  ✹
Image
「狂ったこの世で狂うなら気は確かだ。」

User avatar
Andredron
Miko-Class Veteran
Posts: 535
Joined: Thu Dec 28, 2017 2:37 pm
Completed: Kimi ga nozomu renpy-port(demo), Albatross Koukairoku(demo)
Projects: Sisters ~Natsu no Saigo no Hi~(renpy-port)
Location: Russia
Contact:

Re: Real "Delete" Button. At Save Menu.

#7 Post by Andredron » Sun Sep 04, 2022 4:17 am

viewtopic.php?p=555185#p555185
Slightly updated the code
I'm writing a Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18

Help me to register in QQ International

Honest Critique

Post Reply

Who is online

Users browsing this forum: No registered users