sdkLua module
Import common game helpers from one Lua library.
Import sdk with local sdk = require("sdk"). It combines a subset of game calls and bundled helpers in one table. Updating the downloaded library takes effect after reloading your module. The full gameplay reference also includes combat, inventory, progression, and commerce. Calls without an SDK alias remain available by their documented game name.
| Field | Purpose | Reference |
|---|---|---|
sdk.version | Installed library version string | SDK downloads |
sdk.data | Items, skills, NPCs, pets, quests, and dungeons | Game data |
sdk.entities | Nearby, living, and nearest entity helpers | entities |
sdk.community | Persistent, opt-in community activity reporting | Community reporting |
sdk.ui_sdk | Window helper with geometry, colors, and controls | ui_sdk |
sdk.ui | Direct window and control commands | ui |
sdk.gfx | HUD lines, rectangles, and text | gfx |
sdk.hotkeys | Held keys and press edges | hotkeys |
sdk.http | Asynchronous HTTP requests and optional private profile methods | http |
sdk.sound | Beeps and WAV playback | sound |
sdk.script | Workers, saved module state, and loading, reloading, or unloading modules | script |
sdk.menu | Inspect Sharp menu features and turn them off | menu |
The functions below are aliases of the corresponding game functions, with the same parameters, results, and limits. Each contract link leads to its complete description. You can use either spelling; importing sdk does not change action timing or make an unavailable value available.
local sdk = require("sdk")
function on_tick()
local name = sdk.local_name()
local health = sdk.local_health_fraction()
if name and health ~= nil then
sdk.gfx.text(30, 80, string.format("%s: %.0f%%", name, health * 100),
0xFFFFFFFF, 18)
end
endThis module reads and draws on each tick. See lifecycle for callback timing and examples for complete modules.
Advanced Gameplay Aliases
These are existing facade exports. Their underscore-prefixed names are experimental and must retain the underscore. Check that the function exists in your installed library and handle unavailable results. They have exactly the same contracts as the linked game calls; this library does not make an unavailable game value available.
sdk._tagged_character_resources()
No arguments. Returns eight current/maximum integer resource fields or nil, error. Resource fields.
sdk._inventory_ready_groups()
No arguments. Returns an array of integer ready-group IDs or nil, error. This is not an item list. Ready groups.
sdk._combat_power_source()
No arguments. Returns an unsigned 32-bit power value or nil, error. Combat power.
sdk._remaining_skill_points()
No arguments. Returns nonnegative {mastery, stigma} values or nil, error. Current points.
sdk._legacy_skill_points_source()
No arguments. Returns signed {mastery, stigma} values or nil, error. This differs from the other points calculation. Alternative points.
sdk._aether_energy_source()
No arguments. Returns signed integer energy or nil, error. Aether Energy.
sdk._raw_skill_shortcut_groups()
No arguments. Returns an array of shortcut-group records or nil, error. Group fields.
sdk._skill_shortcut_status(skill_id)
Integer ID from 0 through 4294967295. Returns {cooldown_flag, cast_state, resolved_skill_id} or nil, error; this is not a remaining-cooldown duration. Status fields.
sdk._character_buff_rows()
No arguments. Returns an array of {id, type} records or nil, error. Buff fields.
sdk._active_subscription_types()
No arguments. Returns the active supported type IDs or nil, error. It is not an enumeration of every subscription. Active memberships.
sdk._membership_type_source()
No arguments. Returns the first supported recorded type, 0 for no match, or nil, error. This does not test whether the type is active. Recorded membership.
sdk.start_running()
No arguments. Returns true on dispatch or nil, error. Running request.
sdk.set_infinite_fly(enabled)
One boolean. Arms maintenance after normal takeoff or disables it. Ground walking is unchanged; landing releases control. Returns true when queued, or nil, error. Disable works without a character. Enable/disable and gathering protections.
sdk.infinite_fly_enabled()
No arguments. Returns the current Gameplay toggle as a boolean. Read after the queued setter is processed; this is requested intent, not proof of active flight. Toggle query.
sdk.control_mode()
No arguments. Returns 1 for Action, 2 for Classic, or nil, error. Input mode.
sdk.set_control_mode(mode)
Integer 1 for Action or 2 for Classic. Returns true after confirming the requested mode or nil, error. Mode change.
Character and world
sdk.local_position()
Parameters and result: No parameters; {x, y, z} or nil, error.
sdk.local_flight_ground()
Parameters and result: No parameters; flight HUD distance/surface snapshot or nil, error.
sdk.local_health_fraction()
Parameters and result: No parameters; health fraction or nil, error.
Health contract. Zero is a valid reading.
sdk.local_level()
Parameters and result: No parameters; integer level or nil, error.
sdk.local_name()
Parameters and result: No parameters; UTF-8 name or nil, error.
sdk.local_character_class()
Parameters and result: No parameters; class code or nil, error.
sdk.local_pc_data_id()
Parameters and result: No parameters; character data ID or nil, error.
Character data ID contract. This is not a class code.
sdk.local_resource_text()
Parameters and result: No parameters; displayed {health, mana} strings or nil, error.
sdk.local_sp_text()
Parameters and result: No parameters; displayed SP text or nil, error.
sdk.local_displayed_resources()
Parameters and result: No parameters; numeric health and mana pairs or nil, error.
Numeric resource contract, including the accepted display format.
sdk.current_level_name()
Parameters and result: No parameters; loaded level name or nil, error.
sdk.current_map_id()
Parameters and result: No parameters; map ID or nil, error.
sdk.current_area_id()
Parameters and result: No parameters; area ID or nil, error.
local sdk = require("sdk")
local level, err = sdk.local_level()
if level then log.info("Level " .. level) else log.warn(err) endMovement and travel
sdk.clear_target()
Parameters and result: No parameters; true when the clear request is sent, or nil, error.
sdk.target()
Parameters and result: No parameters; the selected target record, false, or nil, error. Needs Sharp 0.4.10.
sdk.select_target(uid)
Parameters and result: A uid; true, mark when the client confirms the selection, or nil, error.
Select-by-uid contract. Read the server's answer with sdk.target_results(mark).
sdk.entity_by_uid(uid)
Parameters and result: A uid; the entity record, false, or nil, error.
sdk.target_effects()
Parameters and result: No parameters; the selected target's effects, false, or nil, error.
sdk.entity_effects(entity_id)
Parameters and result: Optional entity id; that character's effects (your own without an id), or nil, error.
sdk.skill_results(after)
Parameters and result: Optional sequence; results, latest, capturing.
sdk.target_results(after)
Parameters and result: Optional sequence; results, latest, capturing.
sdk.use_skill(skill_id, target_uid)
Parameters and result: A skill ID and an optional target uid; accepted, reason, mark, or nil, error. Needs Sharp 0.5.0.
Use-skill contract. Read the server's answer with sdk.skill_results(mark).
sdk.action_reason_name(code)
Parameters and result: The integer reason returned by use_skill; its name, such as Success, SkillAction_CoolDown or SkillAction_NotLearned, or Reason_<code> for a code the SDK does not list. A non-integer returns nil. These are the game's local answers, not the server result codes that sdk.result_name names.
local sdk = require("sdk")
if sdk.use_skill then
local accepted, reason = sdk.use_skill(17120000)
if accepted == false then
log.info("Not used: " .. sdk.action_reason_name(reason))
end
endsdk.action_reason_text(code)
Parameters and result: integer reason returned by use_skill; a sentence explaining it, or nil when the SDK has no text for that code. Covers the common refusals and the reasons the game handles specially, including 39 (the skill queue refused the skill), 40 (queued) and 73-79 (an effect blocks that kind of skill). Reason meanings.
local sdk = require("sdk")
local accepted, reason = sdk.use_skill(17120000)
if accepted == false then
log.info(sdk.action_reason_text(reason) or sdk.action_reason_name(reason))
endsdk.skill_queue(skill_id)
Parameters and result: Optional skill ID; the game's skill-queue state table, or nil, error. Needs Sharp 0.5.7. Skill queue contract.
sdk.skill_events(after)
Parameters and result: Optional sequence; events, latest, capturing. Needs Sharp 0.5.7. Skill event contract.
sdk.skill_end_reason_name(code)
Parameters and result: integer reason of a skill event; Completed (0), CancelledByNextSkill (12), or Reason_<code>. A non-integer returns nil.
sdk.casts()
Parameters and result: None; casts, capturing. Needs Sharp 0.5.7. Cast contract.
sdk.entity_cast(uid)
Parameters and result: A caster uid; its latest cast record or false. Needs Sharp 0.5.7. Cast contract.
sdk.combo_skill(skill_id)
Parameters and result: A skill ID; combo_skill, age_ms for the open chain skill that follows it, or false. Needs Sharp 0.5.7. Combo contract.
sdk.combo_skills()
Parameters and result: None; an array of open chain skills {previous, skill, age_ms}. Needs Sharp 0.5.7.
sdk.next_skill(skill_id)
Parameters and result: A skill ID; the open chain skill that follows it, or skill_id itself. With an older Sharp it always returns skill_id.
local sdk = require("sdk")
local accepted, reason = sdk.use_skill(sdk.next_skill(11020000))sdk.result_name(code)
Parameters and result: An integer result code from a skill or target receipt; its name, such as Success, Skill_CoolTime or MainTarget_SameTarget, or Result_<code> for a code the SDK does not list. A non-integer returns nil.
local sdk = require("sdk")
local results = sdk.skill_results and sdk.skill_results() or {}
for _, receipt in ipairs(results) do
if receipt.answered and not receipt.accepted then
log.warn(string.format("Skill %d rejected: %s", receipt.skill, sdk.result_name(receipt.result)))
end
endsdk.request_path(x, y, z)
Parameters and result: Finite world coordinates; true when requested, or nil, error.
Path request contract. A request does not confirm arrival.
sdk.path_destination()
Parameters and result: No parameters; {x, y, z} or nil, error.
sdk.set_dungeon_automove(enabled)
Parameters and result: true to allow quest auto-move in dungeons, false to restore the refusal; true when applied, or nil, error.
sdk.dungeon_automove_status()
Parameters and result: No parameters; status table or nil, error.
Dungeon auto-move status contract.
sdk.destination_marker()
Parameters and result: No parameters; {id, x, y, z} or nil, error.
sdk.popup_message_text()
Parameters and result: No parameters; visible message text or nil, error.
sdk.is_teleport_unlocked(id)
Parameters and result: Destination ID; true, false, or nil, error.
Unlock-query contract. Test for nil separately from a valid false result.
sdk.unlocked_dungeon_waypoints()
Parameters and result: No parameters; ordered ID array or nil, error.
local marker = sdk.destination_marker()
if marker then
local ok, err = sdk.request_path(marker.x, marker.y, marker.z)
if not ok then log.warn(err) end
endItems and shortcuts
sdk.use_item(uid)
Parameters and result: Positive item UID; true on accepted request, or nil, error.
Item-use contract. The UID identifies an inventory item, not an item type.
sdk.shortcut_press(slot)
Parameters and result: Slot 0–59; true when sent, or nil, error.
sdk.shortcut_release(slot)
Parameters and result: Slot 0–59; true when sent, or nil, error.
Release contract. Pair a successful press with a release.
sdk.place_skill(skill_id, slot, combo_index)
Parameters and result: Positive skill ID, slot 0–255, combo 0–3; true or nil, error.
Placement contract. Placement does not activate a skill.
Quests
The quest lists return IDs only, not tracking IDs or active quest UIDs. See the quest journal for a read-only module.
sdk.active_quest_ids()
Parameters and result: No parameters; ordered ID array or nil, error.
sdk.available_quest_ids()
Parameters and result: No parameters; ordered ID array or nil, error.
sdk.completed_quest_ids()
Parameters and result: No parameters; ordered ID array or nil, error.
sdk.claim_quest(id)
Parameters and result: Quest ID; true when requested, or nil, error.
Claim contract, including the valid ID range.
sdk.execute_quest(id, track_id)
Parameters and result: Quest and track IDs; true when requested, or nil, error.
Quest-action contract. The ID-only lists do not provide a track ID.
sdk.submit_quest(quest_uid, reward_index)
Parameters and result: Active quest UID and reward index; true when requested, or nil, error.
Reward-request contract. Do not substitute a quest ID for its active UID.
local quests, err = sdk.active_quest_ids()
if quests then
log.info("Active quests: " .. #quests)
else
log.warn(err)
endMarket queries
sdk.market_query(trade_type)
Alias of game.market_query(), with the same request ID and error results.
sdk.market_snapshot(request_id, first, limit)
Alias of game.market_snapshot(), with the same paging and status fields.
sdk.chat
The shared chat library is available as sdk.chat or
require("chat"). It provides channel choices, visible message snapshots,
availability checks and configured text sending.
sdk.captcha
The shared CAPTCHA API client is available as
sdk.captcha in the online SDK, or require("captcha_api") when the helper
is bundled with a script. It prepares a restricted request to the hosted
five-character image solver and checks asynchronous replies.