|
How do you wait exactly 1 second? |
|
|
|
No i mean EXACTLY 1 second
print(wait(1))
>> 1.120308409813 |
|
|
btw thx for reminding me how to print ;3 |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
for a = 1, 100 do
x = wait(1)
print(x)
end
As you can see wait(1) is never the same
So your best bet is to use wait(1) and let that little difference not matter because there is no way to do like wait(0.9995) to try and get that little difference off because its never the same
If you don't mind busy waiting (And you should because it freezes the game till the time is up)
local x = tick()
repeat
until (tick() - x) >= 1 |
|
|
print(math.floor(wait(1)))
now u got 1 |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
@Super
I laughed harder than I should have |
|
|
Hmmm
Tough question....
Have you tried something like...
local T1 = tick()
repeat game:GetService("RunService").Stepped:Wait()
until T1 - tick() == 1 or T1 - tick() < 1
It's a very lame attempt though. |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
repeat game:GetService("RunService").Stepped:Wait()
Is the same as
Wait()
Because its basically just calling the Wait() function every time the RunService steps
Might as well say
x = tick()
repeat
wait()
until (tick - x) >= 1 |
|
|
Well then use RendrStepped with some fancy RemoteFunction/RemoteEvent |
|
|
This is a mystery for advanced and master scripters. |
|
|
Impossible. It might not even be possible to wait exactly one second in reality. |
|
|
Hmm... Had not factored in relativity.... |
|
|
@Not
Are you insane? A second is just a measurement of time in which we humans had come up with. We can obviously wait that much.
Also duh, I wait that long all the time. Speaking of waiting a second a lot, thank goodness it's summer XD |
|
|
@warspyking: But what is the definition of one second? Does it HAVE one? If so, does its method of measurement ALWAYS return the same time, or is it an average? If it is an average, then it may be impossible to attain the average value. |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
@War
It is for that exact reason that a computer can not understand how long a second is and can not wait exactly that long
Try to describe in words how long a second is, much less in a computer language. |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
The length of time of 9,192,631,770 amounts of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium 133 atom. |
|
|
@Kodran: Is that always exactly the same length of time? |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
1 second is an idea, so yah. |
|
cntkillmeJoin Date: 2008-04-07 Post Count: 49450 |
No one and nothing can wait exactly 1 second when they want. |
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
Yes, like 1 gram is defined as the mass of one cubic centimeter of water at 4°C and 1 lightyear is the distance light travels in 1 year in a vacuum. |
|
|
A second is 1/60th of a minute. A minute is 1/60th of an hour. An hour is 1/24th of a day. A day is 1/360th of a year (unless it's a leap year) and a year is the amount of time it takes for the earth to rotate around the sun.
There done in words... Now for Lua XD
EarthAroundSunTime = 0 --I got stuck here LOL
A_year = EarthAroundSunTime
A_day = A_year/365 or A_year/366
An_hour = A_day/24
A_minute = An_hour/60
A_second = A_minute/60 |
|
|
1 day ~= 24 hours (slightly less)
1 year ~= 365.242 days |
|
cntkillmeJoin Date: 2008-04-07 Post Count: 49450 |
More like the other way around, minutes, hours, etc. are defined by seconds.
And there is not exactly 24hrs in a day, and 360 days in a year (you probably meant 36, but that is still incorrect) |
|
|
Oh, wait. I mean "approximately equal to" with the second "~="
1 year approx. equals 365.242 days. |
|