I've tried starting a new thread with a timer to run renpy.hide_screen() function, but for some reason, that did not work
Hiding a screen with delay/timer.[Solved]
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.
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.
Hiding a screen with delay/timer.[Solved]
What would be the best way to hide a screen 10 seconds after show or call (call preferably, to resume the code afterwards)? It has to be done from a python block so jumping to a different label is not an option (as rest of python code would not be executed). If possible, it should still be allowed to use a button to close it prematurely.
I've tried starting a new thread with a timer to run renpy.hide_screen() function, but for some reason, that did not work
I've tried starting a new thread with a timer to run renpy.hide_screen() function, but for some reason, that did not work
Last edited by xela on Thu Oct 17, 2013 3:52 pm, edited 1 time in total.
Re: Hiding a screen with delay/timer.
Should be fairly easy with time.sleep.
in init block use
and in python block
and then whatever you use to hide the screen.
Just tried it in a renpy screen using python blocks and works flawlessly.
Or break the python block with renpy.pause and carry on afterwards, but haven't tried it myself.
in init block use
Code: Select all
init python:
import timeCode: Select all
time.sleep(amount of seconds) Just tried it in a renpy screen using python blocks and works flawlessly.
Or break the python block with renpy.pause and carry on afterwards, but haven't tried it myself.
Re: Hiding a screen with delay/timer.
Like this?
Code: Select all
screen test_scr:
timer 5.0 action [Hide("test_scr"), Return("value")]
textbutton "X" action [Hide("test_scr"), Return("value")] xalign 1.0 yalign 0.05
label start:
"Line 1"
python:
renpy.say(None, "Line 2")
a = renpy.call_screen("test_scr")
renpy.say(None, "[a]")Re: Hiding a screen with delay/timer.
Thanks for trying but this solves non of my problemsTsapas wrote:Should be fairly easy with time.sleep.
in init block useand in python blockCode: Select all
init python: import timeand then whatever you use to hide the screen.Code: Select all
time.sleep(amount of seconds)
Just tried it in a renpy screen using python blocks and works flawlessly.
Or break the python block with renpy.pause and carry on afterwards, but haven't tried it myself.
There should be a simple solution to this...
=====================================
Here is the simple solution:
Alex wrote:Like this?
Code: Select all
timer 5.0 action [Hide("screen")]- jghibiki
- Regular
- Posts: 125
- Joined: Wed Sep 19, 2012 9:08 pm
- Projects: Dream's Dénouement, Unannounced RPG framework, Renpy-Safe Logger
- Organization: Team Anarky
- IRC Nick: jghibiki
- Location: Minnesota, US
- Contact:
Re: Hiding a screen with delay/timer.
You might be able to do this using overlay screens. The following example would show "Hello" over you're in-game content for 5 seconds before making disappear
e.g.
init python:
import time
showScreen = False
def myOverlay():
if showScreen:
ui.text("Hello!")
ui.timer(5.0, ToggleVariable(showScreen)
label myLabel:
"Before showing text/starting counter"
$showScreen = True
"Stuff can still happen here"
"Eventually the timer will time out and the text will disappear."
e.g.
init python:
import time
showScreen = False
def myOverlay():
if showScreen:
ui.text("Hello!")
ui.timer(5.0, ToggleVariable(showScreen)
label myLabel:
"Before showing text/starting counter"
$showScreen = True
"Stuff can still happen here"
"Eventually the timer will time out and the text will disappear."
Re: Hiding a screen with delay/timer.
That's once again, not what I've asked. You don't need to import time for RenPy's timers to work btw.jghibiki wrote:You might be able to do this using overlay screens. The following example would show "Hello" over you're in-game content for 5 seconds before making disappear
e.g.
init python:
import time
showScreen = False
def myOverlay():
if showScreen:
ui.text("Hello!")
ui.timer(5.0, ToggleVariable(showScreen)
label myLabel:
"Before showing text/starting counter"
$showScreen = True
"Stuff can still happen here"
"Eventually the timer will time out and the text will disappear."
It's a complex screen with 200 lines of code and four different transforms running on it for a duration of 10 seconds. I should have looked into screen language for answer but I've seem to have developed a bad habit of looking for complicated answers in Python before checking in with RenPy
In any case, Alex's on screen timer solution works perfectly.
-
Elementario
- Newbie
- Posts: 9
- Joined: Wed Oct 10, 2018 4:26 am
- Contact:
Re: Hiding a screen with delay/timer.[Solved]
Hi, so I know this is a old thread but I am really trying to look for a solution and can't find it anywhere,
So, I use a sort of achievement system to show a little pop up every now and then if a certain action is done.
The problem I have is that if the achievement pop up is still showing and someone rollsback, the timer breaks and never hides the given screen, any help?
So, I use a sort of achievement system to show a little pop up every now and then if a certain action is done.
The problem I have is that if the achievement pop up is still showing and someone rollsback, the timer breaks and never hides the given screen, any help?
Who is online
Users browsing this forum: enaielei
