Page 1 of 1

Little used features screen Load/Save

Posted: Fri Aug 26, 2022 4:15 am
by Andredron
1) Adding a flashing New sign to the loading screen
FileNewest https://www.renpy.org/doc/html/screen_a ... FileNewest

Code: Select all


transform transform_save_label_new:
    pause 0.5
    linear .5 alpha 0.3
    pause 0.5
    linear .5 alpha 1.0
    repeat
    
###Screen

for i in range(1):
    $ slot = i + 1                                                                                   
    if FileNewest(slot):
          button:                         
                text "New" at transform_save_label_new                                   
Or:

Code: Select all

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

    add FileScreenshot(number) xpos 26 ypos 37
    
    if FileNewest(number):
        add "assets/images/menu/icon_new.png" xpos 26 ypos 37
    
    text file_text xpos 51 ypos 302 size 24 color "#940707" font "assets/fonts/lithos_pro.ttf"
    
    #key "save_delete" action FileDelete(number)

2) Enter a name for the save

viewtopic.php?f=8&t=47676&p=521818&hili ... me#p521818
Or:
viewtopic.php?p=295961#p295961

3)Screenshot of saving your image (Root)

viewtopic.php?f=8&t=56914&p=519355&hili ... me#p519355


4)Additional information to save add

https://patreon.renpy.org/save-metadata ... n-metadata

viewtopic.php?f=8&t=42718


5) A crutch to solve problems with breaking saves
Autor - Alexey Butorin
https://vk.com/@miosion_pub-reshenie-po ... i-na-renpy

We write the code to send the player to a specific "label".

Code: Select all

python:
    if persistent.jump_to:
        j = persistent.jump_to
        persistent.jump_to = False
        renpy.jump(j)
In options.rpy or where it is convenient, we write the following code

Recording data for memories

Code: Select all

init -998 python:
    def _on_save(json):
        json['game_version'] = config.version
        json['jump_chapter'] = current_chapter
    config.save_json_callbacks = [_on_save]
Create a screen similar to the "confirm" screen:

Image

. At the beginning of script.rpy or wherever it is convenient, we write the following code:

Code: Select all

init:
    $ current_chapter = "start"
#===============================================================================================================
init python:
    from __future__ import absolute_import
    from __future__ import division
    from __future__ import print_function
    from __future__ import unicode_literals

    def save_is_compatible(name, page=None):
        
        save_json = FileJson(name=name, page=page)
        
        if save_json is None:
            return None
        else:
            save_version = save_json.get('game_version', '')
            return save_version

    def what_chapter(name, page=None):
        save_json = FileJson(name=name, page=page)
        
        if save_json is None:
            return "start"
        else:
            labels = renpy.get_all_labels()
            to_chapter = save_json.get('jump_chapter', '')
            if to_chapter in labels:
                return to_chapter
            else:
                return "start"
In "file_slots" we write the following action instead of the standard one:


https://sun9-52.userapi.com/impg/rkgaZp ... type=album

Voila! Now, creating a new assembly and updating it, we change the version of the game and when the player tries to load the save, he will receive such a notification, of course, he can be modified, you can set a different action or simply delete the save file, but I think that this is a little wrong.


Link to finished project
https://disk.yandex.ru/d/RpdqgJrqDlQLDg

6) How to round the edges of a save image

Code: Select all

add AlphaMask (FileScreenshot(slot), "alpha.png") xalign 0.5
where alpha.png is the mask to clip on

7)Time spent in the save game
viewtopic.php?t=40407

8)Button Delete
viewtopic.php?f=8&t=59207
viewtopic.php?p=487545#p487545

9) Confirm menu in "Load" of Title menu
confirm argument in FileSave and FileLoad prompt for confirmation before loading the file only if not at the main menu, and only before overwriting existing save file.

Code: Select all

# action for load file asking prompt even if at the main menu
... Confirm("Loading will lose unsaved progress.\n Are you sure you want to do this",FileLoad(slot, confirm = False)))
# action for save file asking prompt even if slot is empty
... Confirm("Are you sure you want to save on this slot?\n This action will overwrite previous save if it existed?",FileSave(slot, confirm = False))

сonfirm = False to avoid prompting user for confirmation twice in case of overwriting file or loading file if not at main menu.

10) To prevent values from being reset after each boot
https://www.renpy.org/doc/html/save_loa ... after-load

Code: Select all

screen edit_value:
    hbox:
        text "[value]"
        textbutton "+" action SetVariable("value", value + 1)
        textbutton "-" action SetVariable("value", value - 1)
        textbutton "+" action Return(True)

label start:
    $ value = 0
    $ renpy.retain_after_load()
    call screen edit_value
11)Loading screen loads last save page
viewtopic.php?p=549947#p549947

12) Add a sound effect when you save a file
Go to the file_slots screen found in screens.rpy, then in the button with action FileAction, you can go add

Code: Select all

button:
  action FileAction(slot)
  activate_sound "sound.mp3"

13)So that the current song fades out while loading
viewtopic.php?p=529474#p529474

Or add a label:

Code: Select all

label after_load:
    stop music fadeout 2.0
    return
14)The load button is not active until there is at least 1 save
viewtopic.php?p=505283#p505283

Before the test, don't forget to clear your renpy data
Windows - C:\Documents and Settings\Admin\Application Data\RenPy

15)Disable question about overwrite save
viewtopic.php?p=492279#p492279

16)The correct way when hover a notification to implement (not Uncle Mugen's example)
viewtopic.php?p=489643#p489643

17)Set up "cloud notifications"
viewtopic.php?p=486646#p486646

18)1 single screenshot for save list
viewtopic.php?f=51&t=25981