generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: TimeTicks's Timer API

Previous Thread :: Next Thread 
TimeTicks is not online. 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
SadisticNub is not online. SadisticNub
Joined: 05 Jan 2013
Total Posts: 4948
02 Oct 2016 02:11 PM
did you know there is handy thing called for loop
Report Abuse
dev_Alekz is not online. 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 is not online. 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
SadisticNub is not online. SadisticNub
Joined: 05 Jan 2013
Total Posts: 4948
02 Oct 2016 02:14 PM
yes
Report Abuse
TimeTicks is not online. 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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
03 Oct 2016 08:02 PM
b


Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
03 Oct 2016 08:03 PM
copycat
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image