Hi,
just a "conceptual" question out of my attempts to get my project more functional and less heavy in terms of assets:
...Is there a way to code a displayable as if it was a timer?
As of now, I've achieved this by creating an animation where every single frame is a number (from 0 to 100= 100 pngs = mental!) and it works, but at the price of a moderate loss in terms of disk space (not to mention health loss in the process on my side, lol).
Once again, thanks to anyone who would share his/her knowledge on the matter...
Text-based timer?
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.
-
- Regular
- Posts: 96
- Joined: Sun Jan 24, 2016 6:51 am
- Projects: undisclosed...
- Contact:
- andrewngn13
- Regular
- Posts: 65
- Joined: Thu Nov 13, 2014 2:41 pm
- Projects: Recast
- Skype: andrewngn13
- Location: Glued to my desktop
- Contact:
Re: Text-based timer?
I'm not sure I understand the question's context...but you want to create a timer displayable is what I'm getting.
and elsewhere
source: viewtopic.php?f=8&t=13381
Code: Select all
init:
python:
# This function will run a countdown of the given length. It will
# be white until 5 seconds are left, and then red until 0 seconds are
# left, and then will blink 0.0 when time is up.
def countdown(st, at, length=0.0):
remaining = length - st
if remaining > 2.0:
return Text("%.1f" % remaining, color="#fff", size=72), .1
elif remaining > 0.0:
return Text("%.1f" % remaining, color="#f00", size=72), .1
else:
return anim.Blink(Text("0.0", color="#f00", size=72)), None
# Show a countdown for 10 seconds.
image countdown = DynamicDisplayable(countdown, length=5.0)
Code: Select all
show countdown at Position(xalign=.1, yalign=.1)
"Feel feel to idea-bounce off me."
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.
-
- Regular
- Posts: 96
- Joined: Sun Jan 24, 2016 6:51 am
- Projects: undisclosed...
- Contact:
Re: Text-based timer?
hi andrewngn13 and thanks for your answer.
Unfortunately that example is not what I was looking for...I'm looking for a counter like from "0" to "10" but I need that numbers to be text and not images (like the one I've created).
Maybe I could create some "image" made of text like:
image counter:
text ("0")
pause 1
text ("1")
and so on...I don't know, I'm just guessing...
Unfortunately that example is not what I was looking for...I'm looking for a counter like from "0" to "10" but I need that numbers to be text and not images (like the one I've created).
Maybe I could create some "image" made of text like:
image counter:
text ("0")
pause 1
text ("1")
and so on...I don't know, I'm just guessing...
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Text-based timer?
Go to the Tutorial game (which you can access from the Renpy Launcher) and check out DynamicDisplayables. That will give you want you want.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
-
- Regular
- Posts: 96
- Joined: Sun Jan 24, 2016 6:51 am
- Projects: undisclosed...
- Contact:
Re: Text-based timer?
Pretty much what andrew posted above. Thanks anywaytrooper6 wrote:Go to the Tutorial game (which you can access from the Renpy Launcher) and check out DynamicDisplayables. That will give you want you want.
- andrewngn13
- Regular
- Posts: 65
- Joined: Thu Nov 13, 2014 2:41 pm
- Projects: Recast
- Skype: andrewngn13
- Location: Glued to my desktop
- Contact:
Re: Text-based timer?
Code: Select all
init:
python:
# This function will run a countdown of the given length. It will
# be white at 5 seconds and, and then red at 0 seconds and 5,
# and then will blink 0.0 when time is up.
def countdown(st, at, length=0.0):
remaining = length + st
if remaining == 0.0:
return anim.Blink(Text("0.0", color="#f00", size=72)), None
elif remaining > 5.0 and remaining < 10.0:
return Text("%1.0f" % remaining, color="#fff", size=72), 1.0
elif remaining > 0.0 and remaining < 10.0:
return Text("%1.0f" % remaining, color="#f00", size=72), 1.0
else:
return anim.Blink(Text("10.0", color="#f00", size=72)), None
# Show a countup for 10 seconds.
image countdown = DynamicDisplayable(countdown, length=0.0)
"Feel feel to idea-bounce off me."
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.
Who is online
Users browsing this forum: VESTED