Skip to content

Update Timers node for tutorial#1185

Open
davidmarr wants to merge 23 commits intoTombEngine:developfrom
davidmarr:Update-timer-node-02-2026
Open

Update Timers node for tutorial#1185
davidmarr wants to merge 23 commits intoTombEngine:developfrom
davidmarr:Update-timer-node-02-2026

Conversation

@davidmarr
Copy link
Copy Markdown
Collaborator

This pull request significantly enhances the flexibility and control of timer nodes in the Timers.lua catalog. The main improvements include expanded argument ranges for timer positioning, new nodes for modifying and querying timer properties (alignment, effects, debug messages, position, and scale), and updates to function signatures to support these changes.

Timer Node Argument and Function Signature Updates:

  • Expanded the allowed range for timer X and Y positions to [-1000, 1000] and updated the corresponding argument documentation for improved clarity and flexibility. [1] [2] [3]
  • Updated the order and grouping of arguments in timer creation functions (CreateTimer, CreateTimerWithEventSet, CreateTimerWithGEventSet) to match the new argument structure and improve usability. [1] [2] [3]

New and Enhanced Timer Property Modification Nodes:

  • Added new nodes for modifying timer alignment (SetTimerAlignment), effects (SetTimerEffects), and debug message settings (SetDebugMessages). These nodes provide runtime control over timer display and debugging.
  • Enhanced the timer position setter (SetTimerPosition) to allow independent X and Y updates using boolean flags, improving flexibility for partial updates.

Timer Property Query Nodes:

  • Introduced new conditional nodes to check if a timer's position (IfPositionIs) or scale (IfScaleIs) matches specified criteria, enabling advanced logic in event scripts.

Internal Data Structure Improvements:

  • Updated the LevelVars.nodeTimers structure to always store alignment and effects properties for each timer, ensuring consistent access and modification.

These changes collectively make timer nodes much more powerful and configurable, supporting a wider range of gameplay and UI scenarios.

References:
[1] [2] [3] [4] [5] [6] [7]

Nodes with modifications are backwards compatible:
Before:
image
image

After the update:
image
image

davidmarr and others added 23 commits February 18, 2026 23:56
Adjust timer node numerical argument metadata (change numeric field from 1 to 2 and increase upper bound to 65535 in relevant nodes) to allow larger/updated value ranges. Remove ticking checks so GetRemainingTime and GetTotalTime always log when the timer exists. Simplify debug logging in IfRemainingTimeIs by removing operator-specific tick gating and normalize float formatting for log output.
Updated timer argument descriptions to clarify that durations can be rounded to the nearest game frame (1/30 of a second).
Update numeric argument metadata in Timers.lua to allow timer durations up to 65535 seconds (previously 1000). The change updates the argument range for the simple countdown, LevelFuncs callback, volume event, and global event timer nodes in TombLib/TombLib/Catalogs/TEN Node Catalogs/Timers.lua to reflect the expanded maximum duration.
Update the argument metadata in Timers.lua for Timer node conditions: change the Numerical argument upper bound from 1000 to 65535 for both "Remaining time" and "Total Time" (in seconds). This is a comment/metadata change only; no runtime logic was modified. Values are still rounded internally to the nearest game frame (1/30s).
Update timer argument metadata in TombLib/TombLib/Catalogs/TEN Node Catalogs/Timers.lua to allow durations up to 86400 seconds (24 hours) instead of 65535. The numerical range for various timer-related nodes and checks (simple countdown, LevelFuncs callback, volume/global event timers, SetRemainingTime, SetTotalTime, IfRemainingTimeIs, IfTotalTimeIs) was adjusted in the annotation/comments so the editor/UI will accept longer timer values. No runtime logic was changed; only the argument metadata was updated.
Replace incorrect "Deciseconds" label with "Centiseconds" in TEN Node Catalogs/Timers.lua (four occurrences). This clarifies the timer argument unit and normalizes comment syntax for consistency.
Add a missing newline at the end of TombLib/TombLib/Catalogs/TEN Node Catalogs/Timers.lua. This is a non-functional change to satisfy POSIX/editor expectations and avoid spurious diff warnings.
Adjust timer argument documentation in TEN Node Catalogs/Timers.lua to use 0.03 (≈1/30s) as the finer timer increment instead of 0.1. The Numerical argument allowed values were updated for several Timer nodes (simple countdown, LevelFuncs callback, volume event, global event, IfRemainingTimeIs, IfTotalTimeIs) to reflect rounding to the nearest game frame (1/30 of a second). These are comment/meta changes describing argument precision; no runtime logic was modified.
Ensure LevelVars.nodeTimers[name] is initialized before reading .debug in multiple timer functions (StartTimer, StopTimer, SetPausedTimer, SetRemainingTime, SetTotalTime, SetLooping, IfRemainingTimeIs, IfTotalTimeIs) to avoid nil indexing errors and enable per-timer debug logging. Also simplify SetTimerColor and SetTimerPauseColor by setting the alpha on the provided color table (color.a = 255 * tColor / paused) and passing it directly to SetUnpausedColor/SetPausedColor instead of constructing a new TEN.Color.
Refactor timer handling in TEN Node Timers: introduce a local SetTimer function (replacing in-file LevelFuncs.Engine.Node.SetTimer usage) and add a CreateStruct helper to centralize/ensure LevelVars.nodeTimers[name] initialization. Replace many repetitive nil-checks with CreateStruct calls. Also update several node argument comment ranges for timer durations/precision (e.g. max reduced from 86400 to 1000 and rounding/precision values adjusted). Minor comment formatting tweaks included.
Replace the fully-qualified LevelFuncs.Engine.Node.SetTimer call with a direct SetTimer invocation in CreateTimerWithGEventSet. This aligns the call with the intended local/global SetTimer function and ensures consistent resolution without changing timer creation logic.
Persist timer alignment and effects in LevelVars.nodeTimers and refactor SetTimerPosition to accept explicit setX/setY flags and simplify value computation. Add new node functions: SetTimerAlignment, SetTimerEffects and SetDebugMessages to modify timer text options and toggle per-timer debug logging. Implement conditional check nodes IfPositionIs and IfScaleIs (with debug logging for position checks) and update argument metadata/comments for the affected timer nodes. Overall improves runtime configurability and debugging for timers.
Reorder parameters for CreateTimer, CreateTimerWithEventSet and CreateTimerWithGEventSet so color/position/alignment/effects/scale come before the debug flag (debug moved to the end). Update the !Arguments annotations: expand Position X/Y ranges to [-1000..1000] with a visible range note, move alignment/effects enumeration entries, and adjust the scale argument metadata/precision. These changes keep the annotation order consistent with the new function signatures.
Rename the parameter named 'debug' to 'show_debug' across timer functions (SetTimer, CreateTimer, CreateTimerWithFunction, CreateTimerWithEventSet, CreateTimerWithGEventSet, and SetDebugMessages) and update their SetTimer calls and assignments to LevelVars.nodeTimers. This is a naming/clarity change only; behavior and stored debug flag remain the same.
Update TEN Node Timers.lua argument annotations and adjust CreateTimerWithFunction signature to match. Position X/Y ranges expanded to -1000..1000 with a visible range note of 0..100; alignment, effects, scale and debug argument declarations reordered. Function parameter order changed accordingly (color/pColor and x/y moved earlier; alignment/effects/scale and debug moved) — callers must be updated to the new parameter order.
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.

2 participants