Game keeps starting for no reason.

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
KnuffelBeestje
Newbie
Posts: 9
Joined: Wed Nov 13, 2019 9:44 am
Contact:

Game keeps starting for no reason.

#1 Post by KnuffelBeestje »

Warning: I'm a complete beginner and I don't really know anything about Python tbh :P

I'm currently creating a loading system instead of using the Save Selector.
I just made a simple label like this:

Code: Select all

label loadgame_label:
    if renpy.can_load("GameSave"):
        $renpy.load("GameSave")
    else:
        $renpy.notify("No save files have been found")
    return
But, once there's no save file found, the game automatically starts for no reason.
I use

Code: Select all

Jump("loadgame_label")
in order to activate the label.
I already tried to use Call instead of Jump but this froze my game, it kept looping the label.
I don't know what I'm doing wrong.
Maybe I forgot something?

Thanks.

User avatar
papillon
Arbiter of the Internets
Posts: 4107
Joined: Tue Aug 26, 2003 4:37 am
Completed: lots; see website!
Projects: something mysterious involving yuri, usually
Organization: Hanako Games
Tumblr: hanakogames
Contact:

Re: Game keeps starting for no reason.

#2 Post by papillon »

Some basic troubleshooting steps. If your code is doing something for no reason whatsoever that you can see, attempt to isolate where the strange behavior is happening.

When something really crazy is going on I often find it handy to put in a ton of say statements so that I'm stepping through every stage of the process and I know exactly which line of code is doing something unexpected.

Code: Select all

label start:

  "Here is the start of the game. This part worked!"
  "Now I'm going to jump to a label."
  call loadgame_label
  "I have now returned from a label, my life is over, end game."
  $renpy.quit()
  
label loadgame_label:
    "I jumped successfully, good start!"
    "Trying to load a game now."
    if renpy.can_load("GameSave"):
        "Loadable game found. Loading..."
        $renpy.load("GameSave")
    else:
        "No loadable game found. Trying to notify."
        $renpy.notify("No save files have been found")
        "Notified. Now returning."
    return
obviously my text is a bit silly there and I'm not actually checking to see if that will run, just trying to give a general idea of how you can investigate weird behavior :D

KnuffelBeestje
Newbie
Posts: 9
Joined: Wed Nov 13, 2019 9:44 am
Contact:

Re: Game keeps starting for no reason.

#3 Post by KnuffelBeestje »

I'm currently juming to the label from the main menu.
Maybe this gives you more clues on what's wrong as you're thinking that you jump to a label from the game start.
It seems only to be not working when I jump from a screen.

Code:

Code: Select all

 textbutton _("Load Game") action Jump("loadgame_label") 
-> from the navigation screen

KnuffelBeestje
Newbie
Posts: 9
Joined: Wed Nov 13, 2019 9:44 am
Contact:

Re: Game keeps starting for no reason.

#4 Post by KnuffelBeestje »

Isn't there a way to just end a label and do nothing else?
Maybe this will resolve the problem.

KnuffelBeestje
Newbie
Posts: 9
Joined: Wed Nov 13, 2019 9:44 am
Contact:

#5 Post by KnuffelBeestje »

UPDATE:
I fixed it, I just re-called the navigation screen and removed "return".

Post Reply

Who is online

Users browsing this forum: No registered users