Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 10 Jun 2012 01:49 PM |
| Usually calling wait() in a script will yield the current thread for about .03 seconds, but I'm getting in excess of .2 seconds. Is anyone else getting this? |
|
|
| Report Abuse |
|
|
| |
|
MM233
|
  |
| Joined: 19 Jun 2008 |
| Total Posts: 925 |
|
|
| 10 Jun 2012 01:56 PM |
| wait() was changed. I believe it's now got 60 FPS, instead of the previous 30 FPS. |
|
|
| Report Abuse |
|
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 10 Jun 2012 01:57 PM |
@mm233 that's probably not it considering it would be .015 not .2
@popin Didn't seem to work. Something must be up with ROBLOX's scheduler thingy |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2012 08:18 PM |
It's dependant on the framerate and probably slightly more (i.e. any amount of time it takes to actually execute the code).
That's all I can think of. |
|
|
| Report Abuse |
|
|
NVI
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 4744 |
|
|
| 10 Jun 2012 09:12 PM |
| wait() yields the current thread. If there's a lot going on in other threads, you're not going to get priority back any time soon. Stop using wait(), you fool. |
|
|
| Report Abuse |
|
|
LPGhatguy
|
  |
 |
| Joined: 27 Jun 2008 |
| Total Posts: 4725 |
|
|
| 10 Jun 2012 09:48 PM |
| You're getting throttled. Use the return value for delta so you're not affected as much. |
|
|
| Report Abuse |
|
|
X135
|
  |
| Joined: 20 Aug 2010 |
| Total Posts: 245 |
|
|
| 10 Jun 2012 10:03 PM |
Yes. It's prone to throttling.
Use wait(1/30)
☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2012 10:46 PM |
Just use the wait function properly instead.
Don't use wait() and don't use wait(1/30) either. Just use wait properly. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
|
| 11 Jun 2012 06:10 AM |
wait() does the following: waits about a frame (approximately in a no-lag situation, actually 1/30th of a second) fires instantly in a no-lag setting auto-throttled if there is no value typed as an argument
~>dat siggy<~ |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
|
| 11 Jun 2012 07:02 AM |
I too would like to know more about an alternative to wait(). I've never used the following functions so could I have them explain their usefulness please?
The wiki doesn't mention thread yielding for delay() but it does for spawn(). Tick() is said to be very accurate and seems promising. Game time apparently only updates during wait() and that would make time() not so useful. |
|
|
| Report Abuse |
|
|
Knexer
|
  |
| Joined: 03 May 2009 |
| Total Posts: 13851 |
|
| |
|
Friaza
|
  |
| Joined: 26 Dec 2008 |
| Total Posts: 6229 |
|
|
| 11 Jun 2012 03:54 PM |
| Either way, my game uses wait() and wait(0.05) thousands of times, I really need to fix this, it's ruining my game... |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2012 06:20 PM |
"So you just come here saying everyone on roblox uses the wait function incorrectly, even the admins and their built in code. And then you don't bother saying how to "actually use it properly." Yeah, because people won't look at you like an idiot now..."
When did I say nobody was using it correctly?
If you use 'wait()', you're accepting the fact that it will wait one frame and that the duration of a frame may vary. You can't expect 'wait()' to wait exactly 1/30 of a second or even a value close to that. If you want to wait 1/30 of a second, you have to use 'wait(1/30)'.
However, why would you wait 1/30 of a second in the first place? Because it's the default time a frame takes, or took? That's not a good reason. Wait the time you want to wait, instead.
"wait() does the following: waits about a frame (approximately in a no-lag situation, actually 1/30th of a second) fires instantly in a no-lag setting auto-throttled if there is no value typed as an argument"
Why does nobody actually understand how the wait function work except me and a few other scripters?
This is how the wait function works: wait() does the following: waits about a frame (approximately in a no-lag situation, actually 1/30th of a second) fires instantly in a no-lag setting auto-throttled if there is no value typed as an argument.
"I too would like to know more about an alternative to wait()."
The wait function has no alternative and shouldn't have an alternative. The point of it is to wait a certain time. Why would you need an alternative?
The point when programming isn't to have 5000 ways to do something, it is to have ONE _GOOD_ way to do it.
@oxcool
If you want to test stuff, use the preview button. Or, at least, create a thread in the OT forum and lock it. |
|
|
| Report Abuse |
|
|
catslats1
|
  |
| Joined: 02 Nov 2009 |
| Total Posts: 138 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 11 Jun 2012 10:18 PM |
As for what you are seeing, along with the 60FPS update, scripts are more aggressively throttled, so if your game is doing too much script stuff rather than just cutting out scripts entirely or slowing down other engine activities it will increase the wait time one scripts.
So, you cannot assume that your code will actually wait for the requested time anymore. |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2012 11:06 PM |
| I'd rather have 30 fps and it be reliable than 60 and unreliable. |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2012 11:08 PM |
@NinjaShadow
Why not just use it correctly and not have any problem? |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 11 Jun 2012 11:33 PM |
"I'd rather have 30 fps and it be reliable than 60 and unreliable."
If you weren't having other problems before then you won't have problems with it now. You have to be doing pretty aggressive operations to actually trigger it. Plus, it's better than before where it would just ungracefully fail. Being slightly harder to work with (Really, it's not much code at all to add a time-step to something once you know how, just local dt = wait(), youramount*speed*dt) |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|