ID:669626
 
Is there an update() proc in byond? Something that runs every frame. Generally used in 3D games I guess but it could be a good proc in byond too
BYOND doesn't update faster than world.tick_lag, so just create a loop with a sleep of world.tick_lag and you'll have effectively the same thing.
For mobs, Stat() runs every tick.
In response to Warlord Fred
Warlord Fred wrote:
For mobs, Stat() runs every tick.

No it doesn't.
mob/Stat()
src << world.time
Always has been approximately 8 ticks per update on Stat(), but it will update right away if you force it.
ah, I didn't know that, thanks
Don't try and run a lot of calculations in Stat though if you plan on that. I've seen some games do that and any time the game lagged the game delay would go up causing Stat() to go slower. To fix that during a game you have to keep typing .Configure delay 0
In response to Zaltron
I know. I was just wondering if there was anything like that in byond. BTW i think if you dont sleep a while loop it would run every frame. Is that correct? I am not gonna use it but it lags the game so much if you even try to do something as simple as assigning a variable.
In response to Dj dovis
Dj dovis wrote:
BTW i think if you dont sleep a while loop it would run every frame. Is that correct? I am not gonna use it but it lags the game so much if you even try to do something as simple as assigning a variable.

You would want to sleep() for the smallest unit of time that the game is running at, i.e world.tick_lag. If you don't include a sleep, the game will simply try to run the code block as fast as it can.
I'd add sleep(-1) somewhere in there or make sure you turn off infinite loop check. I can't remember what it's called and I can't check since I'm on a Mac. You can also do set background = 1 I believe.
In response to Nadrew
Nadrew wrote:
Always has been approximately 8 ticks per update on Stat(), but it will update right away if you force it.

A tad off-topic, but I thought that Stat() was called every seven ticks.
In response to Nadrew
Nadrew wrote:
Always has been approximately 8 ticks per update on Stat(), but it will update right away if you force it.

I've always been curious about this, why 8 ticks? 5 and 10 would make sense for the default tick_lag. 2, 3, 4, and 6 would make sense for having a set number of updates per minute. Having it update every 8 ticks just seems kinda random.
In response to SuperAntx
That has always been my thought, as well.
In response to SuperAntx
SuperAntx wrote:
Nadrew wrote:
Always has been approximately 8 ticks per update on Stat(), but it will update right away if you force it.

I've always been curious about this, why 8 ticks? 5 and 10 would make sense for the default tick_lag. 2, 3, 4, and 6 would make sense for having a set number of updates per minute. Having it update every 8 ticks just seems kinda random.

Perhaps create a feature request for this? world.statupdate or something similar ? or embed it in with world.tick..
In response to A.T.H.K
A.T.H.K wrote:
Perhaps create a feature request for this? world.statupdate or something similar ? or embed it in with world.tick..
Well, statpanels are hardly relevant to today's BYOND, would probably be a waste of time to update them. I'd just like to know the reasoning behind their update timer.
In response to SuperAntx
SuperAntx wrote:
A.T.H.K wrote:
Perhaps create a feature request for this? world.statupdate or something similar ? or embed it in with world.tick..
Well, statpanels are hardly relevant to today's BYOND, would probably be a waste of time to update them. I'd just like to know the reasoning behind their update timer.

True but they still offer the option of having one even via the Interface manager.

I see your point though I have noticed a few rips still have them but more popular games stay clear which is the best option.