TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 02 Oct 2016 02:09 PM |
Useful API to setup timers to manipulate. Documentation should be straightforward.
--server script
local TimerAPI = require(514792625) local Timer1 = TimerAPI.NewTimer() local T1 = TimerAPI.GetTimer(Timer1) local seconds = 60 TimerAPI.Init(0.5) --The amount of seconds to update the timers, in this case (0.5 seconds)
TimerAPI.AddTime(Timer1,5) --Adds 5 seconds to the timer
T1.OnTick:connect(function() --Fired when the timer ticks print(Timer1,TimerAPI.GetTime(T1)) --Gets current time of the timer in [hh:mm:ss] format --You can also do TimerAPI.GetTime(t1,true) to return [hh:mm:ss:ms] format end)
T1.OnStart:connect(function() --Fired when the timer starts print(Timer1,'started') end)
T1.OnPause:connect(function() --Fired when the timer is paused print(Timer1,'paused') end)
T1.OnStop:connect(function() --Fired when the timer stops print(Timer1,'stopped') end)
TimerAPI.Start(Timer1,seconds) --Starts the timer with optional seconds you provide wait(1) TimerAPI.Pause(Timer1) --Pauses the timer wait(1) TimerAPI.Start(Timer1) wait(1) TimerAPI.Stop(Timer1) --Stops the timer
Output:
Timer1 started Timer1 00:01:04 Timer1 paused Timer1 started Timer1 00:01:04 Timer1 00:01:03 Timer1 stopped
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 02:11 PM |
| did you know there is handy thing called for loop |
|
|
| Report Abuse |
|
|
dev_Alekz
|
  |
| Joined: 14 Sep 2013 |
| Total Posts: 171 |
|
|
| 02 Oct 2016 02:12 PM |
| You haven't really elaborated upon the practical application of this API, care to explain in a little more detail? |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 02 Oct 2016 02:13 PM |
did you know there is handy thing called for loop
|
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 02 Oct 2016 02:15 PM |
Practical application: My chess game.
https://www.roblox.com/games/141589686/Ro-Chess-Beta
Players will have their own clock that runs down when it their move and can add an increment every move they take. Other useful applications can be made for GROUP HOLOS and raids and can also be used for simple stuff, like a countdown. It can be used for anything!
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
| |
|