API ReferenceGE Extensionsfreeroam
Freeroam Level Stats
Tracks and persists usage statistics for levels and spawn points. Records spawn counts and timestamps, provides sorted top-level and top-spawn-point queries.
Tracks and persists usage statistics for levels and spawn points. Records spawn counts and timestamps, provides sorted top-level and top-spawn-point queries.
Public API
| Function | Signature | Returns | Description |
|---|---|---|---|
M.recordLevelSpawn | (levelName, spawnPointName?) | nil | Records a spawn event for a level/spawn point |
M.getTopLevels | () | table | Returns levels sorted by frequency, most-recent first |
M.getTopSpawnPoints | (levelName) | table | Returns spawn points for a level, sorted by frequency |
M.getUiStats | () | table | Returns combined top levels and spawn points for UI |
Storage Format
File: /settings/cloud/uiStats.json
{
"levels": {
"west_coast_usa": {
"count": 15,
"lastUsed": "2024-01-15T10:30:00Z",
"spawnPoints": {
"spawns_industrial": {
"spawnPointName": "spawns_industrial",
"count": 8,
"lastUsed": "2024-01-15T10:30:00Z"
}
}
}
},
"vehicles": {}
}How It Works
recordLevelSpawn()increments counters and updates ISO8601 timestamps for level and spawn point- Default spawn points (no name) stored as
"__default__" getTopLevels()sorts by count (descending) but promotes the most recently used level to first positiongetTopSpawnPoints()follows the same sorting strategy per level- Stats cached in memory after first read
Usage Examples
-- Record a level spawn
freeroam_levelStats.recordLevelSpawn("west_coast_usa", "spawns_industrial")
-- Get most-used levels
local topLevels = freeroam_levelStats.getTopLevels()
-- Returns: {{levelName="west_coast_usa", count=15, lastUsed="..."}, ...}
-- Get spawn points for a level
local spawns = freeroam_levelStats.getTopSpawnPoints("west_coast_usa")Notes
- Stats file is in the cloud save directory for cross-device sync
- Timestamps in ISO8601 UTC format
- The
vehiclestable exists in the schema but is not currently populated - Sorting prioritizes the most recently used entry at position 1, then sorts remainder by count
See Also
- Freeroam Big Map Markers - Related reference
- Freeroam Big Map Mode - Related reference
- Freeroam Big Map POI Provider - Related reference
- Freeroam Guide - Guide
Freeroam Gas Stations
Manages gas station POI formatting and simple vehicle refueling in freeroam. Defers to career fuel module when career mode is active.
Freeroam Organizations
Loads and manages organization data used in career mode. Organizations have reputation levels, associated facilities, and delivery capabilities.