ID:160552
![]() Aug 22 2008, 9:33 am
|
|
I've looked around the web, and even here on Byond. Of what I did find wasn't much help. I'm a beginner, so what is a simple way of making a Timer for mini games? I tried using sleep, and the timer would never reset when the mini game was played again.
|
![]() Aug 22 2008, 10:09 am
|
|
Well, however u get in mini-game, in the join code, make it chanqge time back.
|
Okay, i'm sure some OG of BYOND will come and correct me because there is probably some pre-made proc/var for it, though you can try this, I made a lil small demo for it.
Really this depends on how you do it, there is this way... mob You can edit that however you want, really you just use the proc to make an input in seconds and it displays that in the stats, though you can change it to wherever you want to display it, or add minutes and such the same way. |
8BitGeek wrote:
I've looked around the web, and even here on Byond. Of what I did find wasn't much help. I'm a beginner, so what is a simple way of making a Timer for mini games? I tried using sleep, and the timer would never reset when the mini game was played again. The code bellow is suppose to be used as an example. Not as runnable code. var/TimeCounter=0 The above code would be used by running the StartTimer procedure when the mini-game begins. Then run EndTimer procedure when the mini-game ends. |
Bakasensei wrote:
Okay, i'm sure some OG of BYOND will come and correct me because there is probably some pre-made proc/var for it, though you can try this, I made a lil small demo for it. mob You can edit that however you want, really you just use the proc to make an input in seconds and it displays that in the stats, though you can change it to wherever you want to display it, or add minutes and such the same way. I kinda understand it, but could you maybe explain the proc to me, so i know for sure what I'm thinking is correct. Also I noticed after about every 4 numbers in the countdown in that code, the next number would last 2 sec. |
Its because BYOND updates the stat() menu every .8 seconds.
Also its very simple, you should get what it means. |
Bakasensei wrote:
Its because BYOND updates the stat() menu every .8 seconds. Your right, I'm sorry, I need to stop trying to shove more stuff in my brain when I'm stressed out |
This may, or may not work, but of course, it's just an example:
mob/proc ~Duper |
If you're interested, I wrote a timer library last month. I think I have yet to use it in a project, but there is a demo included.
|