|
| 10 May 2015 07:46 AM |
any way to wait() less than .03 Seconds? except .Stepped... cos I'm trying to rotate my Custom Joint at about 100 Frames (as I like to call it) per Rotational requirement... and so that makes it slow, but if I don't add any wait()s it will crash/lag :/ http://gyazo.com/6f98cfff434dc7c5de0495e9dcbb9bd0
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
Saldor010
|
  |
| Joined: 20 Sep 2010 |
| Total Posts: 1035 |
|
|
| 10 May 2015 07:55 AM |
| I'm pretty sure it's impossible to wait any shorter than .05 seconds unless you want to try doing funky coroutine stuff. |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 08:02 AM |
funky couritine? hmmm and, .03 is smaller than .05 so .05 is not the lowest...
l = tick() wait(.001) print(tick() - l) --I did .001 to test if .03 is rlly the minimum >0.030923366546631
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 08:03 AM |
game["Run Service"].RenderStepped:connect(function() -- Runs every frame. end) |
|
|
| Report Abuse |
|
|
Saldor010
|
  |
| Joined: 20 Sep 2010 |
| Total Posts: 1035 |
|
|
| 10 May 2015 08:03 AM |
| Weird, for some reason I always thought 0.05 was the lowest. Maybe I read it somewhere. Oh well, I doubt you'll get lower than 0.03, but you can try. |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 08:05 AM |
epic, that's what I tried in the Joint Demo I just showed... so it's like for i = 1, 100 do .Stepped:wait() --Rotate end
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
|
| 10 May 2015 08:11 AM |
>0.037588919978589 138605.84723939
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 10 May 2015 08:13 AM |
| People used to say that wait(0) would do but I've never tested it or used it |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 08:14 AM |
print(wait(0)) >0.030031839996809 138805.44117299
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 08:15 AM |
dafuq lol l = tick() wait(.0) print(tick() - l) >0.044939279556274
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:11 AM |
Make your own?
local wait = function(sec) local now = tick() while (now < (now + sec)) do end return tick() - now end |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
| |
|
|
| 10 May 2015 09:17 AM |
Tested I hope? XD Thnx I forgot about something similar that eLun gave me for a wait()
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 May 2015 09:20 AM |
lol XD I forgot that empty loops always crash XD
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 10 May 2015 09:29 AM |
Jeez I have no keyboard this'll be fun.
local function wait(s) local start = tick(); local later = start+s; while tick() < later do math.pow(4,5) end -- idk gotta do something return tick()-start; end
Btw busy waiting is bad it's better to run a scheduler in that loop instead |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:38 AM |
MY FIRST POST IN THE SCRIPTERS SUBFORUM WOOOOOOOOOOOOOOOOOO
Verfluchen oder auch loben, Grad wie es ihnen gefällt. |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:41 AM |
thnx eLun, and em... Scheduler? am confused XD sry if this makes u type more and more, and u dont like typing mainly cos ur not on PC) XD
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 10 May 2015 09:43 AM |
I'm on PC but I'm using the on-screen keyboard
Your scheduler is a queue of functions to do instead of busy waiting, which is why I recommend Spawn over coroutines for most cases |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 May 2015 09:44 AM |
function wait(t) local start = tick() while tick() - start < t do coroutine.yield() end end
only works in non-coroutines |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:54 AM |
thnx guys :D
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|