Helper Functions
Built-in helper functions available in all scripts. These are implemented in Lua and run as coroutines.
| Function | Returns | Description |
|---|---|---|
sleep(ms) | void | Yield execution for ms milliseconds |
wait_for_cast_delay(s, timeout?) | bool | Wait until ability at slot s exits cast delay. Returns false on timeout (default 3000ms). |
wait_for_cooling_down(s, timeout?) | bool | Wait until ability at slot s finishes cooldown. Returns false on timeout (default 3000ms). |
wait_until_in_range(target, distance, timeout?) | bool | Wait until target is within distance (meters). Returns false if target dies or timeout (default 3000ms). |
snap_to_target(target, opts?) | bool | Instantly flick to a target with convergence tracking. Options: bone (int), projectile_velocity (float). Returns false if target is invalid or dead. |
aim_at_target(target, opts?) | bool | Smoothly aim at a target over multiple frames. Options: bone (int), projectile_velocity (float), speed (float, default 0.5), threshold (float, default 0.5), timeout (int, default 2000ms). Returns true when within threshold FOV. |
press_ability(s) | void | Press the key bound to ability/item slot s |
hold_key(key, duration?) | void | Hold a key for duration milliseconds (default 500ms) |
hold_ability(s, duration?) | void | Hold the key bound to ability/item slot s for duration milliseconds (default 500ms) |
item_slot_to_key(config_slot) | int | Convert an item_slot config value (0-3) to its configured virtual key. Equivalent to slot_to_key(s + 4). |
debounce(key, cooldown_ms) | bool | Returns true only if enough time has passed since last true return for this key. Useful for cooldown gating. |
find_closest_by_predicate(predicate, max_distance) | player? | Find the closest enemy matching a custom predicate within distance (meters). |
