Skip to content

feat(scripting): expose Genie 4 reserved $gametime to scripts (#45)#51

Merged
monil2233 merged 1 commit into
mainfrom
feature/gametime-script-var
Jun 6, 2026
Merged

feat(scripting): expose Genie 4 reserved $gametime to scripts (#45)#51
monil2233 merged 1 commit into
mainfrom
feature/gametime-script-var

Conversation

@monil2233
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #50, addressing one more reserved variable from #45.

$gametime is the server's clock (Unix seconds) carried on each <prompt time='...'> tag — distinct from $unixtime (local wall clock). The parser already captures it as PromptEvent.ServerTime; this surfaces it to the script-readable globals.

  • Routes PromptEvent through a new OnPrompt handler that sets $gametime from ServerTime.ToUnixTimeSeconds().
  • Guarded by > UnixEpoch so a prompt without a time attribute never publishes a bogus negative epoch.
  • Seeded to "0" in SeedInitial for scripts that read it before the first prompt arrives.

Type of Change

  • New feature

Related Issue

Addresses another item from #45 (does not close it — remaining vars tracked there).

Testing

Genie.Core builds clean (0 warnings / 0 errors). Change is isolated to ScriptGlobalsSync event routing.

Follow-up to #50. $gametime is the server's clock (Unix seconds) carried
on each <prompt time='...'> tag — distinct from $unixtime (local wall
clock). The parser already captures it as PromptEvent.ServerTime; this
surfaces it to the script globals.

Routes PromptEvent through a new OnPrompt handler that sets $gametime from
ServerTime.ToUnixTimeSeconds(), guarded by > UnixEpoch so a prompt without
a time attribute never publishes a bogus negative epoch. Seeded to "0" in
SeedInitial for scripts that read it before the first prompt.
@monil2233 monil2233 merged commit edda26b into main Jun 6, 2026
4 checks passed
@monil2233 monil2233 deleted the feature/gametime-script-var branch June 6, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant