RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Flowgraph Action ModuleFlowgraph AI Recording ModuleFlowgraph Button ModuleFlowgraph Camera ModuleFlowgraph Drift ModuleFlowgraph File ModuleFlowgraph Foreach ModuleFlowgraph Level ModuleFlowgraph Mission ModuleMission Replay ModulePrefab ModuleThread ModuleTimer ModuleTraffic ModuleUI ModuleVehicle Module

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphmodules

Timer Module

Flowgraph module providing a managed timer system with pause/resume, multiple time modes (real/sim/raw), and variable-backed storage. Timers are identified by auto-incrementing IDs and support elapsed

Flowgraph module providing a managed timer system with pause/resume, multiple time modes (real/sim/raw), and variable-backed storage. Timers are identified by auto-incrementing IDs and support elapsed time queries and completion checks.


Module Properties

PropertyValueDescription
moduleOrder0Early initialization order

Class Methods

Lifecycle

MethodDescription
C:init()Creates a variableStorage instance and calls clear()
C:clear()Resets variables, timers table, global time counters, ID counter
C:executionStopped()Calls clear() to reset all timers

Timer Management

MethodDescription
C:addTimer(data)Creates a new timer with mode, duration, optional start time; returns timer ID
C:getTimer(id)Returns the full timer object for a given ID
C:set(id, field, val)Sets a timer field via the variable storage system
C:setPause(id, val)Flags a timer for pause/unpause (applied in afterTrigger)
C:setElapsedTime(id, time)Overrides elapsed time-adjusts start or stores directly if paused
C:setMode(id, mode)Changes timer time mode (dtSim, dtReal, dtRaw); preserves elapsed time
C:getElapsedTime(id)Returns elapsed seconds (paused: stored value; running: global - start)
C:isComplete(id)Returns true when elapsed time ≥ duration

Time Tracking

MethodDescription
C:getGlobalTime(mode)Returns accumulated global time for the given mode
C:onUpdate(dtReal, dtSim, dtRaw)Accumulates delta times into globalTime.real/sim/raw
C:afterTrigger()Finalizes pause flags: converts to elapsed time or adjusts start; finalizes variable changes

ID Generation

MethodDescription
C:getFreeId()Returns next auto-incrementing timer ID

Usage Example

local timerMod = mgr.modules.timer

-- Create a 10-second sim-time timer
local timerId = timerMod:addTimer({
  mode = "dtSim",
  duration = 10,
  time = 0  -- optional: start with elapsed time offset
})

-- Check timer state
local elapsed = timerMod:getElapsedTime(timerId)
if timerMod:isComplete(timerId) then
  -- Timer finished
end

-- Pause and resume
timerMod:setPause(timerId, true)   -- pause
timerMod:setPause(timerId, false)  -- resume

-- Switch time mode (preserves elapsed)
timerMod:setMode(timerId, "dtReal")

Internal Details

  • Timer data backed by flowgraph/variableStorage for merge-strategy-safe state
  • Variables stored as {id}start, {id}mode, {id}duration
  • Pause uses a pauseFlag deferred to afterTrigger() to avoid mid-frame inconsistencies
  • When pausing, elapsed time is snapshot; when resuming, start time is recalculated from current global time
  • Global time modes: dtSim (simulation), dtReal (real/wall), dtRaw (unscaled)

Additional Exports

  • idCounter - number - (see source)

  • idCounter - number - (see source)


See Also

  • Flowgraph Action Module - Related reference
  • Flowgraph AI Recording Module - Related reference
  • Flowgraph Button Module - Related reference
  • FlowGraph Guide - Guide

Thread Module

Flowgraph module for inter-flowgraph messaging and child project management. Enables flowgraph managers to send/receive messages and spawn child flowgraph projects that communicate back via the thread

Traffic Module

Flowgraph module wrapping `gameplay_traffic` and `gameplay_parking` APIs for flowgraph-managed traffic and parked car activation/deactivation. Automatically cleans up traffic and parking state when th

On this page

Module PropertiesClass MethodsLifecycleTimer ManagementTime TrackingID GenerationUsage ExampleInternal DetailsAdditional ExportsSee Also