sleepy time...

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
jagharhemma
Newbie
Posts: 14
Joined: Wed Nov 29, 2017 10:49 am
Contact:

sleepy time...

#1 Post by jagharhemma »

Hello,

Is there a way to get renpy to keep an eye on a variable all the time?

I am using a very simple time cycle just reducing a stamina variable every time the character moves between rooms and today i have to have a conditional statement in every room looking for the value of the stamina variable, and i am afraid i wil forget to paste this at some point, and bugger up the whole thing...

Is there a way for renpy to do this automatically?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: sleepy time...

#2 Post by Remix »

Is between rooms also between labels? If so:
https://www.renpy.org/dev-doc/html/conf ... l_callback

Code: Select all

default stamina = 100

init python:
    
    def cb( lbl, context=False ):
        if "stamina" in globals() and stamina < 25 and lbl not in [ "bedtime", "_quit" ]:
            renpy.jump( "bedtime" )
        pass

    config.label_callback = cb

label start:
    jump cycle
    return

label cycle:
    "[stamina]"
    $ stamina -= 25
    jump cycle

label bedtime:
    "bedtime"
    return
... sort of thing
Frameworks & Scriptlets:

jagharhemma
Newbie
Posts: 14
Joined: Wed Nov 29, 2017 10:49 am
Contact:

Re: sleepy time...

#3 Post by jagharhemma »

Solved by REMIX! Thanks for the support!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], voluorem