Skip to content

KcdMp.on_frame

Runs a function every frame - where a script draws.

The game’s drawing functions (System.DrawLabel, System.DrawLine …) show what they draw for one frame only, so a mark that should stay is drawn again every frame from here; a timer would blink. The handler gets the frame’s length in seconds. Several handlers may be registered; one that raises an error is logged ([KcdMp] frame handler: ...) and removed, so a broken script cannot fill the log sixty times a second. The handlers go with the script set on a /reload. Keep the work small: it runs on the game’s thread, every frame.

KcdMp.on_frame(fn)
Parameter Type
fn function function(dt) end - dt the frame time in seconds

nothing

KcdMp.on_frame(function()
if marker then
System.DrawLabel({x = marker.x, y = marker.y, z = marker.z + 1.6}, 1.4, "here", 1, 0.85, 0.3, 1)
end
end)

KcdMp.on_event · the Helpers group of the index