Difference between revisions of "DCS hook onSimulationFrame"

From DCS World Wiki - Hoggitworld.com
(Created page with "{{Template:DCS_hooks_callbacks |fName= onSimulationFrame |vNum= 2.5.0 |par1= hook |par2= |par3= |par4= |desc= Occurs constantly as the simulation...")
 
(No difference)

Latest revision as of 00:01, 15 May 2021


Envrioment: Server
Function: onSimulationFrame Added with: 2.5.0
Member Of: hook
Syntax: nothing hook.onSimulationFrame( )
Description: Occurs constantly as the simulation is running. This function runs extremely fast, several hundred times a second. It is highly recommended to put in checks to limit how often code can run from this function.


Return Value: nothing
Return Actions:
Examples: Runs whatever code you want at an interval of 10 seconds.
  local lTime = DCS.getModelTime()
  function myCall.onSimulationFrame()
     if lTime + 10 < DCS.getModelTime() then
        lTime = DCS.getModelTime()
        -- whatever code you want
     end 
  end
Related Functions: List of Callbacks: onMissionLoadBegin, onMissionLoadProgress, onMissionLoadEnd, onSimulationStart, onSimulationStop, onSimulationFrame, onSimulationPause, onSimulationResume, onGameEvent, onNetConnect, onNetMissionChanged, onNetConnect, onNetDisconnect, onPlayerConnect, onPlayerDisconnect, onPlayerStart, onPlayerStop, onPlayerChangeSlot, onPlayerTryConnect, onPlayerTrySendChat, onPlayerTryChangeSlot
Notes: