Load game problem (HELP PLS)

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
riveralove
Newbie
Posts: 1
Joined: Wed Nov 22, 2017 2:27 pm
Contact:

Load game problem (HELP PLS)

#1 Post by riveralove »

Code: Select all

init python:
    
    locroom = 0
    hour = 12
    minut = 20
    
    def timelocation():
        global locroom, hour, minut   

        #locroom
        if hour >= 12 and hour <= 18:
            
            locroom = "room_sun1"
            
        elif hour >= 19 and hour <= 20:
        
            locroom = "room_sun2"
                
        elif hour >= 21 or hour <= 11:
            
            locroom = "room_sun3"
                
image room_sun1 = "backgrounds/room_sun1.png"
image room_sun2 = "backgrounds/room_sun2.png"
image room_sun3 = "backgrounds/room_sun3.png"

label room:
        $ timelocation()
        
        show screen room

screen room:
        add locroom
Everything works by code, the problem is that if you save the game and close it completely, the next time you load the save, it says that the variable $ locroom is not defined. Help me how to save these variables, where I read that such values are not saved.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/000statements.rpy", line 485, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "game/script.rpy", line 65, in execute
    screen room:
  File "game/script.rpy", line 65, in execute
    screen room:
  File "game/script.rpy", line 67, in execute
    add locroom
Exception: Not a displayable: 0
Help please!

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Load game problem (HELP PLS)

#2 Post by IrinaLazareva »

Code: Select all

default hour = 12
default minut = 20
image room_sun = ConditionSwitch(
    "18>= hour >=12", "backgrounds/room_sun1.png",
    "20>= hour >=19", "backgrounds/room_sun2.png",
    "hour>=21 or hour <=11", "backgrounds/room_sun3.png",
    )
screen room:
    add "room_sun"
    
label room:
    show screen room
    
   
    "Test"
    $ hour = 20
    "20h"
    $ hour = 22
    "22h"
    $ hour = 13
    "13h"
doc: https://www.renpy.org/doc/html/displaya ... nSwitch

Post Reply

Who is online

Users browsing this forum: No registered users