Combat and skillsLua table
Select targets, use skills by ID through the game's skill queue, follow skill events, casts and combos, inspect skills and buffs.
These advanced game functions expose targeting, skill lists, shortcut state, buffs, and character power. The leading underscore is part of each callable name. They are available directly through game; do not remove it or substitute another name.
These interfaces are experimental and can return nil, error when the character, the relevant game system, or its data is unavailable. An action returning true reports a local dispatch or accepted request, not a completed interaction, changed skill, or successful cast. Read the relevant state again on a later tick. false is a separate, valid rejection result where documented below.
For shortcut press/release and placement, see items and shortcuts. Auto Defense has its own skill catalog, rules, and events; that catalog is not the local character's learned-skill list. Workers and callbacks explains when to read results.
Target by UID, effects, and receipts
These functions need Sharp 0.4.10. SDK 1.7.21 also exposes them as sdk.target(), sdk.select_target() and so on. With an older Sharp the functions are nil, so check if game.select_target then before relying on them.
A uid is the game's own key for a character or object in the current world: an integer from 1 to 4294967295. The game uses the same value when it answers a skill or a target selection. It stays the same while the entity remains in view and can be reused after a world change. The id from game.entities() is a Sharp handle, not a uid; each entity record carries both.
Skill and target receipts record what the game server answered. Capture starts on the first call to any function in this section and stays on for 60 seconds after the most recent call, so call game.skill_results() once in on_start and keep reading while you need answers. Requests made before capture started have no receipt. Receipts are cleared on a world change; the 64 most recent of each kind are kept.
game.target()
Parameters: None.
Returns: The selected target as an entity record (the game.entities() fields plus uid), {uid} alone when the target is selected but not in the local entity list, false when nothing is selected, or nil, error.
local target = game.target()
if target and target.name then
log.info(string.format("Target %s (uid %d) at %.0f", target.name, target.uid, target.distance))
elseif target == false then
log.info("No target")
endgame.entity_by_uid(uid)
Parameters: Integer uid from 1 to 4294967295.
Returns: The entity record with that uid, false when no entity in view has it, or nil, error when the uid matches more than one actor or the entity list is unavailable.
game.select_target(uid)
Parameters: Integer uid from 1 to 4294967295.
Returns: true, mark when the client's targeting system reports this uid as the selected target right after the call, or nil, error. mark is the latest target-receipt sequence before the request.
The returned true confirms the client-side selection. The server answers separately: on a later tick, read game.target_results(mark) and find the record with the same uid. accepted == true means the server accepted the selection. Result 14871 (MainTarget_SameTarget) means it already was the target. Errors include no actor with this uid in view and uid matches more than one actor.
local entities = require("entities")
local function target_nearest_mob()
local mob = entities.nearest(2500, function(entity)
return entity.subkind == "mob" and entity.alive and entity.uid ~= nil
end)
if not mob then
return nil, "no mob"
end
return game.select_target(mob.uid)
endgame.target_effects()
Parameters: None.
Returns: An array of effect records on the selected target, an empty array when it has none, false when nothing is selected, or nil, error (including selected target not in view).
| Field | Meaning |
|---|---|
id | Effect ID (buffs, debuffs, passive and permanent effects) |
level | Effect level from 1 to 255 |
duration_ms | Full duration, when the effect was applied or refreshed during capture |
remaining_ms | Milliseconds left, counted from that application; 0 once expired |
caster_uid | uid of the character that applied it, with the timer fields |
id and level come from the target's current effect list and are always present. The timer fields appear only for timed effects that the game announced while capture was on. Passive effects (class passives, NPC immunities) are listed without a timer. The order is the game's list order.
local SLOW = 19100001
local function target_is_slowed()
local effects = game.target_effects()
for _, effect in ipairs(effects or {}) do
if effect.id == SLOW then
return true, effect.remaining_ms
end
end
return false
endgame.entity_effects(entity_id)
Parameters: Optional id from game.entities(). Omit it to read your own character.
Returns: The same effect records as game.target_effects() for that character, or nil, error for a stale id or a non-character entity.
game.skill_results(after)
Parameters: Optional non-negative integer sequence. Only receipts with a larger sequence are returned.
Returns: results, latest, capturing: an array of receipts (oldest first), the newest sequence (0 before any receipt), and whether capture is currently active.
| Field | Meaning |
|---|---|
sequence | Increasing receipt number; use it as the next after |
skill | Skill ID |
sent | The client sent this skill to the server |
answered | The server replied |
result | Server result code, when answered; 0 is success |
accepted | true when the server accepted the skill, when answered |
latency_ms | Milliseconds from sending to the reply, when both were seen |
age_ms | Milliseconds since the request (or the reply when no request was seen) |
phase | "start" for an ordinary skill, "charge" for the start of a charged skill, "fire" for the release of a charge. nil before Sharp 0.5.2 |
How to read a skill press:
- No new receipt after a few ticks: the client did not send the skill at all. It stopped it locally, for example on cooldown, without a valid target, or while the character could not act.
sentand notanswered: the server has not replied yet. Treat it as unknown after about two seconds and do not press again automatically.answeredandaccepted: the server accepted the cast.- A charged skill has no
startreceipt. Its start is achargereceipt and its release is afirereceipt, each with its ownaccepted. answeredand notaccepted: the server rejected it.sdk.result_name(result)gives the reason, for exampleSkill_CoolTime(6161),Skill_TooFar(6148) orSkill_NoMP(6154).
Acceptance means the server started the skill. It does not prove that it hit or that an effect landed; read game.target_effects() for that.
local sdk = require("sdk")
local SLOT = 3
local mark = 0
function on_start()
local _, latest, capturing = game.skill_results()
mark = latest
log.info("Skill receipts capturing: " .. tostring(capturing))
end
local function press_and_mark()
local _, latest = game.skill_results()
mark = latest
game.shortcut_press(SLOT)
game.shortcut_release(SLOT)
end
function on_tick()
local results, latest = game.skill_results(mark)
for _, receipt in ipairs(results) do
if receipt.answered then
log.info(string.format("Skill %d: %s", receipt.skill,
receipt.accepted and "accepted" or sdk.result_name(receipt.result)))
end
end
mark = latest
endgame.target_results(after)
Parameters: Optional non-negative integer sequence, as for game.skill_results().
Returns: results, latest, capturing. Receipts have the same fields as skill receipts, with uid (the selected uid) instead of skill. Target codes include 14871 MainTarget_SameTarget, 15400 Target_Fail_NotExist and 15401 Target_Fail_TooFar.
Use a skill by ID
This function needs Sharp 0.5.0. SDK 1.7.22 also exposes it as sdk.use_skill() and adds sdk.action_reason_name(). With an older Sharp it is nil, so check if game.use_skill then before relying on it.
game.use_skill(skill_id, target_uid)
Uses one of your character's learned skills by its skill ID. The skill does not have to be on the hotbar. The game treats the call like a key press for that skill: it runs its usual checks (learned, cooldown, cost, target, range, character state) and sends the request itself.
Parameters:
| Parameter | Meaning |
|---|---|
skill_id | Integer skill ID from 1 to 4294967295, as listed by game._raw_skill_entries() |
target_uid | Optional uid of another entity. Omit it (or pass nil) for self skills and to use the current target |
When target_uid is given and that entity is not already your target, it is selected first, exactly as game.select_target(uid) does, and the skill is used only once the game confirms the selection. Your own uid is not a valid target_uid; omit it for skills you cast on yourself.
Returns: accepted, reason, mark, or nil, error.
| Value | Meaning |
|---|---|
accepted | true when the game accepted the use, false when it refused it locally and sent nothing |
reason | The game's own answer as an integer; sdk.action_reason_name(reason) names it |
mark | Latest skill-receipt sequence before the call, for game.skill_results(mark) |
The game accepts with one of three reasons:
reason | Name | Meaning |
|---|---|---|
0 | Success | The skill was requested now |
33 | SkillAction_TryToMoveToUseSkill | The target is out of range; the character walks to it and uses the skill on arrival |
40 | SkillAction_ReservedSkill | Another skill is still running; this one is queued behind it |
Common refusals are 7 (SkillAction_NotLearned), 35 (SkillAction_CoolDown), 41 (SkillAction_NotReserved_ByCoolDown), 24 (SkillAction_NoTarget), 29 (SkillAction_TargetIsDead), 9 (SkillAction_NotEnoughMP), 15 (SkillAction_NotConditionReady), 21 (a passive skill), 22 (a stigma skill that is not equipped) and 54 (SkillAction_InvalidMoveState, for example while mounted).
nil, error means the call was not made: an invalid argument, no actor with this uid in view, uid matches more than one actor, selection not confirmed by the targeting system, local player action system unavailable (not in the world yet), or skill use function unresolved for this client (the game was updated and Sharp has not found the function).
accepted == true means the game took the request, not that the server started the skill. For that, read the receipt on a later tick: a record for the same skill with accepted == true in game.skill_results(mark). Call game.skill_results() once in on_start so capture is already running.
Because the game handles the call like a key press, it also applies its own assistance: a skill that needs a target may pick one when none is selected, and reason 33 moves the character. For a charged skill, one call starts the charge and the server's answer arrives as a charge receipt; releasing the charge through this function has not been verified. Skills that are aimed at a ground location, channeled or toggled have not been verified with this function either.
local sdk = require("sdk")
local HEAL = 17120000
local pending = nil
local wait = 0
function on_start()
game.skill_results()
end
local function use(skill, target_uid)
if not game.use_skill then
return nil, "Sharp 0.5.0 is required"
end
local accepted, reason, mark = game.use_skill(skill, target_uid)
if accepted == nil then
return nil, reason
end
if not accepted then
return false, sdk.action_reason_name(reason)
end
pending = {skill = skill, mark = mark, age = 0}
return true
end
function on_tick(dt)
wait = math.max(0, wait - dt)
if pending then
pending.age = pending.age + dt
for _, receipt in ipairs(game.skill_results(pending.mark)) do
if receipt.skill == pending.skill and receipt.answered then
log.info(receipt.accepted and "Skill started" or sdk.result_name(receipt.result))
pending = nil
break
end
end
if pending and pending.age > 2 then
log.info("No answer for the skill request")
pending = nil
end
elseif wait == 0 and (game.local_health_fraction() or 1) < 0.7 then
local ok, why = use(HEAL)
if not ok then
log.info("Heal not used: " .. tostring(why))
end
wait = 1
end
endSkill queue, events, casts and combos
These functions need Sharp 0.5.7. SDK 1.7.23 also exposes them as sdk.skill_queue(), sdk.skill_events() and so on, and adds sdk.action_reason_text(), sdk.skill_end_reason_name() and sdk.next_skill(). With an older Sharp they are nil, so check if game.skill_queue then before relying on them.
They share the capture that skill receipts use: the first call starts it and it stays on for 60 seconds after the most recent call. Call one of them in on_start and keep calling while you need answers. Events, casts and combos are cleared on a world change.
The game's skill queue
When you press a skill while another one is still running, the game keeps the new skill in its skill queue and sends it as soon as the running skill can be cancelled. game.use_skill goes through the same queue: reason 40 means the skill is waiting there. Only one skill waits at a time; a newer press replaces it.
game.skill_queue(skill_id)
Parameters: Optional skill ID from 1 to 4294967295.
Returns: a table, or nil, error.
| Field | Meaning |
|---|---|
queued_skill | Skill waiting in the game's queue, 0 when none |
queued_ms | Milliseconds it has waited, when known |
queue_mode | true when the game routes skill presses through its queue (the queue option is on, or Auto Battle or Player Assist is active) |
can_queue | Only with skill_id: true when using it now would queue it (reason 40) instead of starting it |
running_skill, running_ms | Your character's current skill and how long it has run, when one is running |
casting, cast_ms | true and the cast time while that skill is a cast |
attack_speed | Server play rate of the running skill in 1/10000; 10000 is normal speed |
lock_ms, lock_remaining_ms | When the running skill can be cancelled by the next one, and how long until then |
end_ms, end_remaining_ms | When the running skill's animation ends, and how long until then |
capturing | Whether packet capture is running |
lock_ms and end_ms are learned: the game reports a skill's cancel and end times when the next skill cuts it short, so they appear after the skill has been followed by another one once in this capture. They are the game's nominal times scaled by attack_speed, an estimate rather than a server guarantee. For a cast, lock_ms is the cast time.
game.skill_events(after)
Parameters: Optional non-negative integer sequence. Only events with a larger sequence are returned.
Returns: events, latest, capturing: an array of your character's skill events (oldest first), the newest sequence (0 before any event), and whether capture is running. The 128 most recent events are kept.
kind | When |
|---|---|
queued | A skill entered the game's queue |
unqueued | It left the queue: normally right before its sent event; without one it was dropped (its combo ended, or another skill was used instead) |
sent | The game sent the skill to the server; reserved is true when it came from the queue |
started | The server started it; for a cast, once with casting = true and cast_ms when the cast begins and again when it fires |
rejected | The server refused it; result is the server code (sdk.result_name) |
completed | It ran to its end (reason 0) |
cancelled | The next skill cut it at its cancel point (reason 12) |
interrupted | It was stopped early: result for a stopped cast, otherwise reason |
Every event has sequence, kind, skill and age_ms; started and sent may carry target_uid. completed, cancelled and interrupted carry elapsed_ms when the start was seen. sdk.skill_end_reason_name(reason) names the end reason.
local sdk = require("sdk")
local mark = 0
function on_start()
local _, latest = game.skill_events()
mark = latest
end
function on_tick()
local events, latest = game.skill_events(mark)
for _, event in ipairs(events) do
if event.kind == "interrupted" then
log.info(string.format("Skill %d interrupted: %s", event.skill,
event.result and sdk.result_name(event.result) or sdk.skill_end_reason_name(event.reason)))
elseif event.kind == "sent" and event.reserved then
log.info("Queued skill " .. event.skill .. " sent")
end
end
mark = latest
endgame.casts()
Parameters: None.
Returns: casts, capturing: an array of the casts of every character and monster in view, plus casts that ended in the last 1.5 seconds with their outcome.
| Field | Meaning |
|---|---|
source_uid | uid of the caster |
skill | Skill ID |
target_uid | uid of the cast's target, when it has one |
duration_ms, elapsed_ms, remaining_ms | Cast time, time since it began, time left |
progress | From 0 to 1 |
state | "casting", "completed" (the skill fired), "interrupted" or "expired" (no answer one second after the cast time) |
result | Server code of a stopped cast, for example 6152 Skill_Abnormal |
reason | End reason when the cast's skill ended early |
targets_me | true when the target is your character |
local | true for your own casts |
Only real casts appear: skills with a cast bar. Instant skills fire without one and are not listed. defense.monster_casts() adds monster positions and area estimates to the same notices.
game.entity_cast(uid)
Parameters: Integer uid from 1 to 4294967295.
Returns: that caster's latest cast record (fields of game.casts()), or false when it has none.
local function interrupt_if_casting_at_me(uid, interrupt_skill)
local cast = game.entity_cast(uid)
if cast and cast.state == "casting" and cast.targets_me and cast.remaining_ms > 200 then
return game.use_skill(interrupt_skill, uid)
end
endgame.combo_skill(skill_id)
Parameters: Integer skill ID from 1 to 4294967295.
Returns: combo_skill, age_ms when using skill_id has opened a combo (chain) skill that is still available, or false.
The server opens a chain skill right after its preceding skill starts and closes it a few seconds later. sdk.next_skill(skill_id) returns the open chain skill or skill_id itself. A queued chain skill is dropped when its chain closes.
game.combo_skills()
Parameters: None. Returns: an array of open chain skills, {previous, skill, age_ms}.
local sdk = require("sdk")
local ROTATION = {11020000, 11010000, 11200000}
-- Use the next rotation step, following combos, and let the game queue it.
local function step(index, target_uid)
local skill = sdk.next_skill(ROTATION[index])
local accepted, reason = game.use_skill(skill, target_uid)
if accepted == nil then
return nil, reason
end
if not accepted then
return false, sdk.action_reason_text(reason) or sdk.action_reason_name(reason)
end
return true, reason == 40 and "queued" or "started"
endWhat the use_skill reasons mean
sdk.action_reason_text(reason) returns the meaning of the reasons below, from the game's own handling of each.
reason | Meaning |
|---|---|
39 | The game tried to queue the skill and the queue refused it: skill queuing is off in the game options, the skill is the one already running, or it is a glide action skill, which never queues. Nothing was sent and the game shows no message. |
40 | Another skill is running; this one waits in the queue and is sent when the running skill can be cancelled. |
73 | An effect on your character blocks active skills, and this skill has neither a physical nor a magical damage type. |
74 | An effect on your character blocks physical skills, and this skill deals physical damage. Magical skills, basic attacks and skills that ignore the block still work. |
75 | An effect on your character blocks magical skills, and this skill deals magical damage. Physical skills, basic attacks and skills that ignore the block still work. |
76-79 | An effect blocks item skills, basic attacks, skills that move your character, or movement-control skills. |
For 73-79 the game shows the blocking effect's own message; game.entity_effects() lists the effects on your character. A skill's damage type is its SkillDamageType in the client skill table.
Targeting
game._selected_target_identity()
Parameters: None.
Returns: {type, value, variant} with integer fields, or nil, error.
| Field | Meaning |
|---|---|
type | Selection category from 0 to 2; 0 is the cleared category and 1 is a key-based selection |
value | Selected identity represented as a signed 64-bit Lua integer |
variant | Additional category value from 0 to 255 |
Keep all three fields together when comparing selections. A readable record does not establish that its value is a valid input for every targeting action. Large identities can appear negative because Lua uses signed integers. Refresh the record after changing character or world.
function on_start()
local target, err = game._selected_target_identity()
if not target then
log.warn(err)
return
end
log.info(string.format("Selection type %d, identity %d, variant %d",
target.type, target.value, target.variant))
endgame._select_target_key(key)
Parameters: A positive integer from 1 to 9223372036854775807 whose least significant 32 bits are nonzero.
Returns: true when the selection request is dispatched, or nil, error for invalid input or an unavailable action.
Supply a known game target key for the current session. The id in a nearby entity snapshot is not a targeting key and must not be passed here. A successful call does not validate the target-key domain or prove that the game selected the intended target. Observe the selection record and the game afterward. Use game.clear_target() to clear a selection.
game._interact_target_key(key)
Parameters: The same positive integer key range and nonzero least-significant-32-bit requirement as _select_target_key.
Returns: true when the interaction request is dispatched, or nil, error.
The key must identify the intended interactable target in the current session. Dispatch does not confirm that an interaction window opened or an objective progressed. This call is not a direct attack or cast-by-target command.
Action control
game._cancel_local_action()
Parameters: None.
Returns: true when a request to cancel the local character's current action is dispatched, or nil, error when unavailable.
It does not report which action was cancelled or confirm that the action stopped. It is separate from clearing the selected target or changing a path destination.
game._use_emote(id)
Parameters: Integer emote ID from 1 to 2147483647.
Returns: true when the emote request is dispatched, or nil, error.
Use an emote ID available to the character. This call does not enumerate owned emotes and does not confirm that the animation played.
Learned skills
game._raw_skill_entries()
Parameters: None.
Returns: A snapshot with count and a rows array, or nil, error.
| Documented field | Meaning |
|---|---|
count | Number of rows in this snapshot, including empty entries |
rows[].source_index | Zero-based position in the skill list |
rows[].id | Unsigned 32-bit skill ID; 0 represents an empty entry |
rows[].level | Stored skill level from 0 to 255 |
Rows preserve list order and empty entries. count is not the number of learned skills with positive IDs. For a learned-skill display, skip rows whose id is 0. The fields listed here are the supported gameplay fields; do not use other returned fields as persistent identifiers.
function on_start()
local skills, err = game._raw_skill_entries()
if not skills then
log.warn(err)
return
end
for _, skill in ipairs(skills.rows) do
if skill.id ~= 0 then
log.info(string.format("Skill %d, level %d", skill.id, skill.level))
end
end
endgame._raw_specialized_skill_entries()
Parameters: None.
Returns: A snapshot with count and a rows array, or nil, error. Each row's documented gameplay fields are id, level, and slots.
| Field | Meaning |
|---|---|
count | Number of rows |
rows[].id | Skill ID |
rows[].level | Currently 0; not a learned-skill level reading |
rows[].slots | Three slot records in current order |
rows[].slots[].index | Stored slot index from 0 to 255 |
rows[].slots[].id | Specialization part ID; 0 can represent an empty slot |
An empty array is a valid result. Unused slot records contain zero values. For an occupied slot, use its stored index rather than the Lua array position when forming a specialization request. Read a learned skill's actual level from the learned-skill snapshot, not this row's level field. Other returned fields are not supported as persistent identifiers.
Shortcut state
game._raw_skill_shortcut_groups()
Parameters: None.
Returns: An array of occupied skill shortcut groups in list order, an empty array when none exist, or nil, error.
| Documented field | Meaning |
|---|---|
source_index | Zero-based position in the shortcut list |
slot_index | Stored zero-based shortcut slot |
skill_ids | Array of up to four stored skill IDs for this group |
raw_inline_skill_ids | Array of four stored ID values, preserving empty values |
skill_ids and raw_inline_skill_ids are different views and need not have equal lengths or identical contents. Use the first for the group's listed skills. Other returned fields are not supported as persistent identifiers. Read skill status separately; a group does not itself provide a cooldown duration or cast result.
game._raw_shortcut_bar_entries()
Parameters: None.
Returns: An array of occupied ordinary shortcut-bar entries in list order, an empty array when none exist, or nil, error.
| Documented field | Meaning |
|---|---|
source_index | Zero-based position in the ordinary bar list |
slot_index | Stored slot index |
mirror_slot_index | Second stored slot index for comparison |
kind | Numeric entry category |
item_id | Stored item-type ID |
skill_id | Stored skill ID |
candidate_id | Additional stored ID value |
The ordinary bar is separate from the skill shortcut groups. The API preserves differing slot indexes and stored IDs rather than choosing a replacement. No category-name mapping is supplied for kind. An item-type ID is not the inventory UID required by game.use_item(). Other returned fields are not supported as persistent identifiers.
game._skill_shortcut_status(skill_id)
Parameters: Integer skill ID from 0 to 4294967295.
Returns: {cooldown_flag, cast_state, resolved_skill_id} with integer fields, or nil, error.
| Field | Meaning |
|---|---|
cooldown_flag | Stored status indicator, 0 or 1; not a cooldown duration |
cast_state | 0 when no state entry is present; otherwise a state code from 1 to 256 |
resolved_skill_id | Effective skill ID after the game's current remapping |
With an available character system, a skill ID of 0 returns three zero values. The API does not supply named casting states, remaining cooldown milliseconds, range checks, or guaranteed cast eligibility. A remapped ID can differ from the input ID.
function on_start()
local groups, err = game._raw_skill_shortcut_groups()
if not groups then
log.warn(err)
return
end
for _, group in ipairs(groups) do
for _, skillId in ipairs(group.skill_ids) do
local status, statusError = game._skill_shortcut_status(skillId)
if status then
log.info(string.format("Slot %d, skill %d, state %d",
group.slot_index, status.resolved_skill_id, status.cast_state))
else
log.warn(statusError)
end
end
end
endUpgrades and specialization
game._current_skill_upgrade_requirements(skill_id, current_level)
Parameters: Integer skill ID from 0 to 4294967295 and integer current level from 0 to 2147483646.
Returns: {found=true, character_level, mastery_points, stigma_points}, or nil, error when the requirement cannot be read. There is no documented found=false result.
The integer fields describe the next-level requirement for that skill and current level. They are not the character's remaining points. Compare them with the remaining points and game.local_level(). Meeting these displayed requirements does not guarantee that an upgrade request will be accepted.
game._skill_upgrade_candidate(skill_id)
Parameters: One Lua integer skill ID. The request uses its least significant 32 bits; prefer an actual ID returned by the learned-skill list rather than relying on integer wrapping.
Returns: true when the client accepts the upgrade request, false when it rejects the request, or nil, error when unavailable.
This action can spend skill points. Send it only after choosing the intended skill. Re-read game._raw_skill_entries() and remaining points on a later tick to observe any change. Do not repeat a request simply because the new level is not visible immediately.
game._specialized_skill_equip_request(part_id, slot)
Parameters: Two Lua integers: specialization part ID and slot. The request uses the part ID's least significant 32 bits and the slot's least significant 8 bits. Prefer the actual part ID and slot index from the specialized-skill snapshot.
Returns: true when the client accepts the equip request, false when it rejects it, or nil, error when unavailable.
Read the specialized-skill rows again on a later tick to observe whether the slot changed. A successfully submitted request is not confirmation of an equipped part.
Buffs and power
game._character_buff_rows()
Parameters: None.
Returns: An ordered array of {id, type} records for the local character, an empty array when none match, or nil, error.
id is the effect ID and type is the effect level from 0 to 255. For level, remaining time and caster on any character, use game.entity_effects() and game.target_effects(). This interface does not remove effects.
game._combat_power_source()
Parameters: None.
Returns: The local character's current combat-power value as an integer from 0 to 4294967295, or nil, error.
Zero is a valid readable value. Re-read after equipment or character changes rather than keeping a cached power value indefinitely.
Points and energy
game._remaining_skill_points()
Parameters: None.
Returns: {mastery, stigma} with nonnegative integer values, or nil, error.
This calculation uses the character's current skill totals minus spent points. It can differ from the alternative calculation below. An inconsistent or unavailable snapshot returns an error rather than partial points. Use this result when comparing the current upgrade requirements.
game._legacy_skill_points_source()
Parameters: None.
Returns: {mastery, stigma} with signed integer values, or nil, error.
This alternative calculates base points minus spent points plus the stored bonus. It does not include every contribution that can affect the other points calculation and is not interchangeable with it. Values can be negative; do not silently clamp them or use this result as proof that an upgrade will succeed.
game._aether_energy_source()
Parameters: None.
Returns: Remaining Aether Energy as a signed integer, or nil, error.
Zero is a valid readable value. This call only reads energy; it does not use an item, purchase energy, or enable automatic consumption.
function on_start()
local points, pointsError = game._remaining_skill_points()
local power, powerError = game._combat_power_source()
if points then
log.info(string.format("Mastery %d, stigma %d",
points.mastery, points.stigma))
else
log.warn(pointsError)
end
if power ~= nil then
log.info("Combat power " .. power)
else
log.warn(powerError)
end
endGuardian powers
game._guardian_crystal_counts()
Parameters: None. Returns: An array of four signed integer values, or nil, error. The first three slots calculate base plus bonus minus used for crystal categories 1, 2, and 3. The fourth slot is currently a zero placeholder, not a reading of another crystal category. Values can be negative. The array does not supply costs or a computed number of purchasable powers; its categories are not the selection function's talent-type codes.
game._learned_guardian_power_keys()
Parameters: None. Returns: An ordered array of signed integer learned-power keys, an empty array when none exist, or nil, error. These keys do not supply names, levels, or a mapping to the selection function's two arguments.
game._daevanion_board_snapshot()
Parameters: None. Returns: A table {points, open_nodes}, or nil, error.
open_nodes is an array of the Daevanion board node IDs the character has
opened; these are the same values as game._learned_guardian_power_keys().
points has one row per point type with these integer fields:
| Field | Meaning |
|---|---|
type | 1 Daevanion Crystal, 2 Conquest Crystal, 3 Battle Crystal, 4 and 5 seasonal crystals. |
base | Points earned. |
bonus | Bonus points from items. |
used | Points spent on open nodes. |
available | base + bonus - used. |
Nodes are either open or closed; a node has no separate level. Use
character_build for each node's board,
position, grade, stat or skill bonus, and for the full layout of every board.
local board, err = game._daevanion_board_snapshot()
if board == nil then
log.warn(err)
else
for _, point in ipairs(board.points) do
log.info(string.format("Point type %d: %d used, %d available",
point.type, point.used, point.available))
end
log.info("Open nodes: " .. #board.open_nodes)
endgame._guardian_power_select_candidate(talent_type, talent_id)
Parameters: Exactly two integers identifying a talent category and talent. Returns: true when selection is invoked, false when the required window or panel is absent, or nil, error when the character or action is unavailable. Open the relevant guardian-power window first. Selection is not a completed purchase or upgrade and does not confirm that points were spent.
See the SDK library for exported helper spellings and errors and limits for failure handling.