Core Functions
This module provides essential functions that nearly all scripts require: callbacks for executing code, utilities for logging, time management, game information access, and settings manipulation.
Callbacks 🔄
Callbacks are the primary mechanism for executing your script logic. Define these functions in your script and the core will automatically invoke them at the appropriate times.
on_tick()
Executes every game tick (approximately every 25ms). This is where most game logic belongs.
on_map_load()
Triggers when a new map loads. Called before on_tick for the new map.
on_login_tick()
Executes during the login screen, before entering the game world. Useful for automating login and character selection.
on_packet_recv(packet: in_packet) -> boolean
Intercepts incoming packets from the server. Return true to allow or false to block. Requires plugin structure. See Packet Handlers.
on_packet_send(packet: out_packet) -> boolean
Intercepts outgoing packets to the server. Return true to allow or false to block. Requires plugin structure. See Packet Handlers.
INFO
Callback names must match exactly as shown above. The core registers functions by name.
function on_tick()
-- Your game logic here
end
function on_map_load()
-- Map initialization code here
endGame Information
core.get_world_id() -> number | nil
Returns the current world ID (e.g., Kronos).
core.get_channel_id() -> number | nil
Returns the current channel ID.
core.change_channel(channel_id: number)
Switches to the specified channel. Must be out of combat.
core.is_evading() -> boolean
Returns true if currently evading.
core.is_solving_rune() -> boolean
Returns true if currently solving a rune.
core.is_in_cutscene() -> boolean | nil
Returns true if currently in a cutscene.
core.get_update_time() -> number
Returns the current game update time in milliseconds. Useful for timing operations.
Settings API ⚙️
The Settings API provides runtime access to game settings. Changes are automatically synced to the web UI and persist across sessions.
Finding Setting Paths
Developer Mode (Recommended)
- Open Settings in web menu
- Press
Ctrl+Shift+Dto enable Developer Mode - Right-click any setting to copy its path
Path Format: category.subcategory.property
Examples: autos.autoPot.hp.enabled, hacks.godmode, autos.autoPot.hp.value
core.get_setting(path: string) -> value | nil
Retrieves a setting value by path.
Returns: Setting value (boolean, number, or string) or nil if not found.
local auto_hp = core.get_setting("autos.autoPot.hp.enabled")
local threshold = core.get_setting("autos.autoPot.hp.value")core.set_setting(path: string, value: boolean | number | string) -> boolean
Updates a setting value. Changes sync automatically to the web UI.
Returns: true on success, false on failure.
Type Matching Required
The value type must match the setting's expected type or a Lua error will be thrown.
-- ❌ Error: expects boolean, got number
core.set_setting("autos.autoPot.hp.enabled", 123)
-- ✅ Correct
core.set_setting("autos.autoPot.hp.enabled", true)
core.set_setting("autos.autoPot.hp.value", 75)Common Setting Paths
| Setting Path | Type | Description |
|---|---|---|
| Autos | ||
autos.autoPot.hp.enabled | boolean | Enable auto HP potion |
autos.autoPot.hp.value | number | HP threshold (0-100) |
autos.autoPot.hp.keybind | string | HP potion keybind |
autos.autoPot.mp.enabled | boolean | Enable auto MP potion |
autos.autoPot.mp.value | number | MP threshold (0-100) |
autos.autoLogin.enabled | boolean | Enable auto login |
autos.autoLogin.worldId | number | World ID (see table below) |
autos.autoLogin.channel | number | Channel number (0 = random, 1-40) |
autos.autoLogin.charIndex | number | Character slot index |
| Hacks | ||
hacks.godmode | boolean | Godmode toggle |
hacks.petLoot | boolean | Pet loot toggle |
hacks.kami | boolean | Kami (teleport hack) toggle |
hacks.speedHack | boolean | Speed hack toggle |
| Combat | ||
combat.combos.enabled | boolean | Enable combo attacks |
combat.combos.delay | number | Delay between attacks (ms) |
| Packets | ||
packets.streamingEnabled | boolean | Enable packet streaming |
World ID Mapping
When configuring auto login, use world IDs instead of world names for easier scripting:
| World Name | World ID | Notes |
|---|---|---|
| Scania | 0 | NA - Default world |
| Bera | 1 | NA |
| Kronos | 45 | NA - Reboot (40 channels) |
| Hyperion | 70 | NA |
| NA CW Heroic | 52 | NA - Classic Worlds (10 channels) |
| NA CW Interactive | 48 | NA - Classic Worlds (10 channels) |
| Luna | 30 | EU |
| Solis | 46 | EU |
| EU CW Heroic | 54 | EU - Classic Worlds (10 channels) |
| EU CW Interactive | 49 | EU - Classic Worlds (10 channels) |
Channel Numbers:
0= Random channel (system selects automatically)1-40= Specific channel number (user's perspective)- Channel conversion to server format is handled automatically
Example:
-- Set auto login to Kronos, Channel 5, Character slot 2
core.set_setting("autos.autoLogin.worldId", 45) -- Kronos
core.set_setting("autos.autoLogin.channel", 5) -- Channel 5
core.set_setting("autos.autoLogin.charIndex", 2) -- 3rd characterLogging
core.log(message: string)
Prints a white message with prefix [-].
core.log_error(message: string)
Prints a red message with prefix [!].
core.log_warning(message: string)
Prints a yellow message with prefix [?].
INFO
Use Lua's tostring() function to convert numbers and booleans to strings for logging.