Skip to content

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.

lua
function on_tick()
    -- Your game logic here
end

function on_map_load()
    -- Map initialization code here
end

Game 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)

  1. Open Settings in web menu
  2. Press Ctrl+Shift+D to enable Developer Mode
  3. 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.

lua
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.

lua
-- ❌ 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 PathTypeDescription
Autos
autos.autoPot.hp.enabledbooleanEnable auto HP potion
autos.autoPot.hp.valuenumberHP threshold (0-100)
autos.autoPot.hp.keybindstringHP potion keybind
autos.autoPot.mp.enabledbooleanEnable auto MP potion
autos.autoPot.mp.valuenumberMP threshold (0-100)
autos.autoLogin.enabledbooleanEnable auto login
autos.autoLogin.worldIdnumberWorld ID (see table below)
autos.autoLogin.channelnumberChannel number (0 = random, 1-40)
autos.autoLogin.charIndexnumberCharacter slot index
Hacks
hacks.godmodebooleanGodmode toggle
hacks.petLootbooleanPet loot toggle
hacks.kamibooleanKami (teleport hack) toggle
hacks.speedHackbooleanSpeed hack toggle
Combat
combat.combos.enabledbooleanEnable combo attacks
combat.combos.delaynumberDelay between attacks (ms)
Packets
packets.streamingEnabledbooleanEnable packet streaming

World ID Mapping

When configuring auto login, use world IDs instead of world names for easier scripting:

World NameWorld IDNotes
Scania0NA - Default world
Bera1NA
Kronos45NA - Reboot (40 channels)
Hyperion70NA
NA CW Heroic52NA - Classic Worlds (10 channels)
NA CW Interactive48NA - Classic Worlds (10 channels)
Luna30EU
Solis46EU
EU CW Heroic54EU - Classic Worlds (10 channels)
EU CW Interactive49EU - 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:

lua
-- 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 character

Logging

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.