API ReferenceGE Extensionsflowgraphnodesenvironment
Random Time of Day
- **File:** `extensions/flowgraph/nodes/environment/randomTimeOfDay.lua`
Overview
- File:
extensions/flowgraph/nodes/environment/randomTimeOfDay.lua - Name:
Random Time of Day - Category:
repeat_instant - Description: Generates a random time of day between two specified hours, outputting both a numeric value and formatted string.
Pin Schema
Input Pins
| Name | Type | Description |
|---|---|---|
fromHour | number | Starting hour (0–23). Default: 9. Hardcoded. Slider. |
toHour | number | Ending hour (0–23). Default: 17. Hardcoded. Slider. |
use24Hour | bool | If true, formats as 24-hour (HH). If false, 12-hour with AM/PM. Default: false. |
Output Pins
| Name | Type | Description |
|---|---|---|
time | number | Time of day on a 0–1 scale. 0.5 is midnight. |
timeString | string | Formatted time string (e.g., "2 PM" or "14"). |
Behavior
- work(): Clamps input hours to 0–23. Converts hours to BeamNG's 0–1 time scale (offset by 0.5 so midnight = 0.5). Generates a uniformly random time in the specified range. Handles wrap-around (e.g., 22 to 02). Outputs both numeric and string representations.
Time Conversion
- BeamNG time-of-day:
0and1= noon,0.5= midnight. - Hour-to-TOD formula:
(hour / 24 + 0.5) % 1
Notes
- Supports wrap-around ranges (e.g., fromHour=22, toHour=6 spans midnight).
- Both hour inputs have integer slider gizmos (0–23).
Tags
#flowgraph #node #ge #environment #timeofday #random
Additional Exports
postInit()
-
name-string- (see source) -
icon-string- (see source) -
description-string- (see source) -
category-string- (see source) -
pinSchema-table- (see source) -
tags-table- (see source)
See Also
- Directional Gravity - Related reference
- Get Cloud by ID - Related reference
- Get Fog - Related reference
- FlowGraph Guide - Guide