Reply to Re: Wait times
If you don't have an account, just leave the password field blank.
> the actual amount of frames waited might be shorter.
Indeed it is for yedink and other old dinks. However I believe that Seth has messed with the timing system on his end so that the frame-draw time is explicitly locked, so it doesn't apply for most users.
> and there were two calls to update_frame between each time the loop was run.
It appears that when a script callback is added to the callback list by running wait() etc it is added with no "timer" value (i.e. the time to wait) which is only calculated a frame later. This is the same for all engines!
You can see this in action in yedink while it's looping by opening the callbacks window and then setting it to pause on every frame, then stepping through by unpausing. The timer value will flip-flop between zero when it hits the wait, and then a game tick some time in the future.
I did a little test by adding the line
to scripting_add_callback() so that when a wait is triggered and the callback added to the list, it sets the initial timer value meaning it gets run on the next frame, rather than waiting to calculate a value, which ends up running things as one would expect them to, and you get a debug line each pframe:
This means I was wrong in the top post somewhat, but it is odd that it's not like this by default.
Also what did redink1 do to the emojis?
Indeed it is for yedink and other old dinks. However I believe that Seth has messed with the timing system on his end so that the frame-draw time is explicitly locked, so it doesn't apply for most users.
> and there were two calls to update_frame between each time the loop was run.
It appears that when a script callback is added to the callback list by running wait() etc it is added with no "timer" value (i.e. the time to wait) which is only calculated a frame later. This is the same for all engines!
You can see this in action in yedink while it's looping by opening the callbacks window and then setting it to pause on every frame, then stepping through by unpausing. The timer value will flip-flop between zero when it hits the wait, and then a game tick some time in the future.
I did a little test by adding the line
callback[k].timer = game_GetTicks() + callback[k].min;
to scripting_add_callback() so that when a wait is triggered and the callback added to the list, it sets the initial timer value meaning it gets run on the next frame, rather than waiting to calculate a value, which ends up running things as one would expect them to, and you get a debug line each pframe:
? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 18 pframe: 18 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 98ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 19 pframe: 19 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 16ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 20 pframe: 20 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 14ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 21 pframe: 21 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 15ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 22 pframe: 22 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 16ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 23 pframe: 23 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 14ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 24 pframe: 24 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 16ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 25 pframe: 25 ? [Scripting] scripting_kill_callbacks(3) ?? Callback added to 1. ? Called script 3 from callback 1. Difference of 15ms ? [Scripting] scripting_resume_script(3) ?[Lua] get sprite value frame from sprite 2 ?[Lua] get sprite value pframe from sprite 2 frame: 26 pframe: 26
This means I was wrong in the top post somewhat, but it is odd that it's not like this by default.
Also what did redink1 do to the emojis?