Violet

Flame

On this page

The core.flame module drives the Auto Flame state machine that lives under the Autos → Auto Flame panel. It writes through the same settings the web UI exposes, so changes show up in the menu and persist across sessions. The frontend widget and your Lua script share state — toggling one is visible to the other.

Auto Flame rerolls an equip's additional options — the bonus-stat lines rebirth flames grant — and stops when a roll raises the item's combat power (CP). Unlike Auto Cube, it doesn't match on individual stat lines; it leans on the game's own item scoring to decide whether a roll is an improvement.

Target must be in your Equip inventory, not worn

Combat-power scoring compares the target against whatever is worn in its body-part slot, so an already-equipped item scores against itself and always reads a 0 change — the run could never tell a good roll from a bad one. Auto Flame refuses an equipped target up front (result.status = "item_equipped"). Move the item into your Equip tab and pass its positive inventory slot.

How a run decides to stop

Before each flame the equip's current CP is re-read — that is the score the next roll has to beat.

  • On auto-apply flames the server commits every roll, so the score to beat ratchets up as you go; the run keeps the item the moment a roll lands above where it was.
  • On choice flames the roll is only offered. Auto Flame scores the offered candidates and takes one only if it beats the current CP, otherwise it rerolls and the equip is left untouched.

Either way the run stops on the first net improvement, or when the Max Flames cap is reached.

before → after

get_status().result carries oldCp (the equip's CP when the run started) and newCp (its CP after the latest roll), so you can report the net gain even when a run ends only slightly up — or, on an auto-apply tier that never recovered, honestly down.

Functions

core.flame.start([opts: table]) -> boolean, string?

Configures and starts an Auto Flame run. All opts fields are optional — anything you omit keeps its current setting. The slot must be non-zero (either passed in opts or already configured) or start() returns false with an error message.

opts fields:

FieldTypeDescription
slotnumberEquip inventory slot of the item to flame (Equip Tab slot 1 → N). Must be positive — an equipped item (negative slot) can't be scored, so the run stops immediately with item_equipped.
item_idnumberItem ID of the rebirth flame to spend. 0 (the default) uses whatever flame is on hand.
max_flamesnumberSafety cap: stop after this many flames (1999; widget default 10).

Returns: true on success, or false, "<error message>" if the slot isn't set, max_flames is out of range, or the autos module isn't ready.

lua
-- Tap the trigger using existing settings
core.flame.start()

-- Flame the item in Equip slot 5 with any flame on hand, cap at 50
local ok, err = core.flame.start({
    slot       = 5,
    item_id    = 0,      -- any flame
    max_flames = 50,
})
if not ok then core.log_error(err) end

core.flame.stop() -> boolean

Disables Auto Flame. Returns true if the toggle was flipped, false if the autos module isn't loaded. Safe to call when not running.


core.flame.is_running() -> boolean

Convenience wrapper for "is the Enable Auto Flame checkbox on right now?". Returns true while a run is active.


core.flame.get_status() -> table

Returns a snapshot of the current run.

FieldTypeDescription
runningbooleanWhether the Auto Flame toggle is on.
statestringState machine state: "idle", "waiting_result", "evaluating_roll", "waiting_commit", "checking_result".
slotnumberSlot the run is targeting.
flames_usednumberFlames consumed in this run — the value the Max Flames cap is measured against.
run_start_cpnumberThe equip's combat power when the run started.
current_cpnumberThe equip's combat power after the most recent roll.
baseline_cpnumberThe score the next roll has to beat (the equip's current CP, re-read before each flame).
resulttableLive status object — see fields below.

result fields (mirrors what the web UI consumes; not every field is present in every state):

FieldTypeDescription
statusstring"flaming", "rolling", "done", "item_not_found", "item_equipped", "no_flames", or "max_reached".
flamesUsednumberFlames used so far this run.
oldCpnumber?The equip's CP at the start of the run (present once the run has scored the item).
newCpnumber?The equip's CP after the latest roll.

Status values

statusMeaning
flamingA flame has been sent; waiting on the roll to land.
rollingA choice-tier roll is being scored, or a reroll is in flight.
doneA roll beat the item's CP; the run stopped on the improvement.
item_not_foundNo item at the configured slot.
item_equippedThe target is worn (negative slot); move it to the Equip tab and use a positive slot.
no_flamesNo usable flame found (none matching item_id, or none at all).
max_reachedThe Max Flames cap was hit before an improvement landed.
lua
local s = core.flame.get_status()
core.log(string.format("[%s] slot=%d  flames=%d  CP %d -> %d",
    s.state, s.slot or 0, s.flames_used, s.run_start_cp, s.current_cp))

if s.result and s.result.status == "no_flames" then
    core.log_error("Out of flames!")
end

Example: flame until improved, then report the gain

lua
plugin = {
    name        = "Flame Watchdog",
    version     = "1.0.0",
    author      = "you",
    description = "Flames an item until CP improves, logs the net gain",
    load        = true,
}

local last_flames = 0

function on_tick()
    local s = core.flame.get_status()
    if not s.running then return end

    if s.flames_used ~= last_flames then
        last_flames = s.flames_used
        core.log(string.format("Flame %d  CP %d (start %d)",
            s.flames_used, s.current_cp, s.run_start_cp))
    end

    local r = s.result
    if r and r.status == "done" then
        core.log(string.format("Done: %d -> %d (+%d)",
            r.oldCp or 0, r.newCp or 0, (r.newCp or 0) - (r.oldCp or 0)))
    elseif r and (r.status == "no_flames" or r.status == "max_reached") then
        core.log_error("Flame run stopped: " .. tostring(r.status))
    end
end

Example: start a capped run on an inventory item

lua
-- Reflame the item in Equip slot 5, using any flame on hand, up to 100 flames.
-- The item must be sitting in your Equip tab (not worn) so its CP can be scored.
local ok, err = core.flame.start({ slot = 5, item_id = 0, max_flames = 100 })
if not ok then return core.log_error(err) end