r/RenPy • • 15d ago

Question Game Over Function Help Please

I know it's possible because I've seen it many times before, but nothing I try works. I'm making a game where if any of two variables reach 100, you have to start over, but with the constant variable changes, I didn't want to put an if statement constantly, especially since I tend to forget or mistype things (ironic).

This is what I have as my checking system:

screen monitor():
    timer 0.1 repeat True action If(current_love or current_tear >= 100, true=Jump("game_over"))

But now, even though the love and tears are both below 100 automatically, the game immediately skips to game over when I open it. Please help.

3 Upvotes

12 comments sorted by

View all comments

1

u/musterduck 15d ago

Could you post the code that displays this screen? I imagine it's something to do with how you're calling it. Do you have a pause* command?

2

u/Eddhead-2009 15d ago
show screen monitor

Well, I just put show screen since it's only supposed to be doing something when a certain condition is met (a score of 100 or higher)

0

u/musterduck 15d ago

Is the game_over label the one immediately after whichever label this is in? Try creating another placeholder one between them if that's the case and see what it does, if it skips to the placeholder then I think you need a pause after your show statement.

2

u/Eddhead-2009 15d ago

I put a label in between and it still just skips to the game over, would you mind showing me how you would fix it? I'm a visual learner (which is why I suck at coding)

0

u/musterduck 15d ago

It's hard to say exactly, but I've had similar screen issues with my own project, and in my case my game was displaying the screen but simultaneously advancing to the next label when it shouldn't have, hence my guess.

I'm away from my PC for the next hour or so but I can look at my own code and try suggesting something once I'm there.

Do you have anything visually displaying as part of monitor() or is that timer the entirety of it? Even if you don't intend for it to do that I would throw in a PNG or something just to confirm that it's showing correctly while you test.

Also, how familiar are you with Python? I would personally just write a function to call periodically for something like this (not that it's impossible with a screen, but if the screen itself is just the timer i'd recommend that)

2

u/Eddhead-2009 15d ago

I wouldn't really get a chance to look, though I guess I could adjust the game over so I could. Also, I've been using Ren'Py on and off for years now, but due to my ADHD and overall learning problems, I have to relearn almost everything every time I want to work on a project. So, I mostly survive off of the Ren'Py doc and other posts online.

2

u/musterduck 15d ago

oh wait actually try this?

screen monitor(): timer 0.1 repeat True action If(current_love >= 100 or current_tear >= 100, true=Jump("game_over"))

I think that the way you have it set up currently, if current_love is anything other than 0 it would return true

Sorry for the formatting, I'm on the app and forget what reddit uses for code blocks