SOLVED: How to add custom load screen when loading game?

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
storykween
Regular
Posts: 154
Joined: Mon Sep 30, 2013 1:17 pm
Completed: Serafina's Saga, Quantum Conscience, Echoes of the Fey, miraclr - Divine Dating Sim
Organization: Woodsy Studio
Location: St Louis
Contact:

SOLVED: How to add custom load screen when loading game?

#1 Post by storykween »

I'm trying to add a custom loading screen that displays on screen while a saved game is loading in the background. My game takes a few seconds to load, and a few seconds yet more on mobile devices, so I want to make sure the player doesn't think the game has crashed.

I tried creating a simple loading screen like so:

Code: Select all

screen loadingGame:
    modal True
    zorder 200
    style_prefix "confirm"
    add "gui/overlay/confirm.png"
    xfill True
    yfill True
    add "loading" xalign 0.5 yalign 0.5
-- and having it display before loading the game, like so:

Code: Select all

 
 screen file_slots(title):
 
 	<---default code here---->
 
      button:
            action [Show("loadingGame"), FileAction(slot)] 

But it never shows up. Does anyone know how to fix this? And while I'm at it, how can I ensure it only shows up when people are loading, and not saving?

Thanks!
Last edited by storykween on Fri Aug 25, 2017 4:06 pm, edited 1 time in total.
Image
My website: woodsy-studio.com

TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: How to add custom load screen when loading game?

#2 Post by TheChatotMaestro »

I'm useless at coding, but from a somewhat convolutedly logical point of view: you put it before the game loads, and set it to vanish when the main menu shows up... But the problem is, it can't show up until the game loads, and by then the main menu is already up. Does that make sense? (You might have to make it load the loading screen and then load the rest of the game, and I don't know how to make that happen.)

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

Re: How to add custom load screen when loading game?

#3 Post by Imperf3kt »

TheChatotMaestro wrote: Wed Aug 23, 2017 8:32 pm I'm useless at coding, but from a somewhat convolutedly logical point of view: you put it before the game loads, and set it to vanish when the main menu shows up... But the problem is, it can't show up until the game loads, and by then the main menu is already up. Does that make sense? (You might have to make it load the loading screen and then load the rest of the game, and I don't know how to make that happen.)
The OP is asking about loading a saved game not loading the game itself. For that, there's presplash
From the old documentation: https://www.renpy.org/wiki/renpy/doc/co ... ader_Image
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Natalie
Newbie
Posts: 17
Joined: Thu Jun 16, 2016 10:50 pm
Projects: Serment - Contract with a Devil
Contact:

Re: How to add custom load screen when loading game?

#4 Post by Natalie »

storykween wrote: Mon Aug 21, 2017 9:55 pm
Maybe something like this (Code not tested)?

Code: Select all

screen file_slots(title):

    # other codes
	
     button:
         if renpy.get_screen("load"):
             action Show("loadingGame", x = slot)
         else:
             action FileSave(slot)

Code: Select all

screen loadingGame(x):
	
    # Whatever you want to show in the loading screen
	
    timer 0.01 action FileLoad(x)
	
Image
Follow Serment (JRPG dungeon crawler/Visual Novel hybrid) on Steam!

User avatar
storykween
Regular
Posts: 154
Joined: Mon Sep 30, 2013 1:17 pm
Completed: Serafina's Saga, Quantum Conscience, Echoes of the Fey, miraclr - Divine Dating Sim
Organization: Woodsy Studio
Location: St Louis
Contact:

Re: How to add custom load screen when loading game?

#5 Post by storykween »

@Natalie, thanks so much, your code led me to the solution!

I couldn't use your code exactly, because the button didn't like having a condition on the action while also containing a vbox.

Here's what I ended up using:

Code: Select all

screen file_slots(title):

    # other codes
	
          button:
                 action Show("loadingGame", x = slot)


screen loadingGame(x):
    
    # display and formatting code here
    
    if renpy.get_screen("load"):
        timer 0.01 action FileLoad(x)
    else:
        timer 0.01 action [FileAction(x), Hide("loadingGame")]
This way the loading screen always triggers, but hides itself immediately if you're only saving a game.

Thanks for everyone's help!
Image
My website: woodsy-studio.com

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]