User Tools

Site Tools


4rpl:commands:msg_frameadvance

Index

:!: Available in version 1.3 and later.

MSG_FrameAdvance

Description

“MSG_FrameAdvance” is a message that is automatically sent every frame of the game. Any listening script can receive this message. Frames happen at up to 60 times per second. See GetMouseDelta for an example of what this might be good for.

The frame advance process is as followed:

Loop 1, 2, or 4 times based on speed:
{
  PreUpdate
  Units
  PostUpdate
  return to top of loop
}
FrameAdvance
If high FPS is on, run FrameAdvance again for the interpolation frame
Start next update


Examples

:Frame	
	#This function is set to get called by the MSG_FrameAdvance message.
	#This message comes every game frame (60 fps when in high fps mode).
	#This callback also happens when the game is paused. Exercise caution when using this callback since
	#it runs on the 'in-between' frames between game updates as well as on game update frames.
        Trace(GetGameFrameCount)
 
:Once
	RegisterForMSG("MSG_FrameAdvance" "Frame")
RegisterForMSG("MSG_FrameAdvance" "Frame")

Index

4rpl/commands/msg_frameadvance.txt · Last modified: 2024/02/03 13:51 by Vertu