Skip to content

Star Force

The core.starforce module drives the Auto Star Force state machine that lives under the Autos → Auto Starforce panel. It writes through the same settings the web UI exposes, so changes show up in the menu and persist across sessions.

TIP

Star Force runs on the equipped or inventory item at the configured slot. Negative slot numbers refer to equipped items (e.g. -11 = weapon); positive numbers refer to Equip Tab slot 1 → N in the inventory.

Insufficient meso protection

The state machine refuses to send a catch packet if the player can't cover the next attempt's cost — sending one without enough mesos disconnects the client. get_status().result.status will report "insufficient_meso" when this happens and the run will stop on its own.

Functions

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

Configures and starts an Auto Star Force 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
slotnumberEquipment slot. Negative = equipped (e.g. -11 = weapon), positive = Equip inventory slot.
targetnumberStop at this star level (1-30).
safeguardbooleanUse safeguard for 15→16, 16→17, 17→18 attempts (adds a non-discounted 2× base surcharge).
sunny_sundaybooleanApply the 30% Sunny Sunday discount.
mvp_tierstring | number"none", "silver", "gold", "diamond" (or 0-3). Discount only applies up to 17 stars.

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

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

-- Configure everything in one shot
local ok, err = core.starforce.start({
    slot         = -11,        -- weapon
    target       = 17,
    safeguard    = true,
    mvp_tier     = "gold",
    sunny_sunday = false,
})
if not ok then core.log_error(err) end

core.starforce.stop() -> boolean

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


core.starforce.is_running() -> boolean

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


core.starforce.get_status() -> table

Returns a snapshot of the current run.

FieldTypeDescription
runningbooleanWhether the Auto SF toggle is on.
statestringState machine state: "idle", "waiting_catch", "waiting_result", "next_item", "done".
slotnumberSlot the run is targeting.
current_starsnumberLast-observed star count of the target item.
target_starsnumberConfigured target.
attemptsnumberCatch packets sent in this run.
spentnumberTotal mesos billed in this run.
resulttableLive status object — see fields below.

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

FieldTypeDescription
statusstring"enhancing", "done", "item_not_found", "item_boomed", "insufficient_meso", or "timeout".
starsnumberStar count at the time of the status update.
attemptsnumberRun attempt count.
spentnumberRun mesos spent.
lastCostnumber?Cost of the most recent attempt.
nextCostnumber?Cost of the next attempt (only on insufficient_meso).
currentMesonumber?Player's meso pool (only on insufficient_meso).
lua
local s = core.starforce.get_status()
core.log(string.format("[%s] %d★ → %d★  (%d attempts, %d mesos)",
    s.state, s.current_stars, s.target_stars or 0, s.attempts, s.spent))

if s.result and s.result.status == "item_boomed" then
    core.log_error("Item went boom!")
end

core.starforce.estimate_cost(item_level: number, current_star: number [, opts: table]) -> number

Returns the meso cost of one attempt at current_star stars on an item of the given required level. Uses the GMS formula with discounts and safeguard surcharge applied.

If opts is omitted, the live settings (safeguard, sunny_sunday, mvp_tier) are used — handy for asking "what would the next click cost right now?".

opts fields:

FieldTypeDescription
safeguardbooleanOverride safeguard.
sunny_sundaybooleanOverride Sunny Sunday.
mvp_tierstring | numberOverride MVP tier (same encoding as start()).
lua
-- Cost of going 16 → 17 on a level-150 weapon with safeguard + Gold MVP
local cost = core.starforce.estimate_cost(150, 16, {
    safeguard = true,
    mvp_tier  = "gold",
})
core.log("Next attempt: " .. tostring(cost) .. " mesos")

Example: stop on boom or low mesos

lua
plugin = {
    name        = "SF Watchdog",
    version     = "1.0.0",
    author      = "you",
    description = "Logs SF progress and stops on boom",
    load        = true,
}

local last_attempts = 0

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

    if s.attempts ~= last_attempts then
        last_attempts = s.attempts
        core.log(string.format("Attempt %d  ★%d  spent=%d",
            s.attempts, s.current_stars, s.spent))
    end

    local r = s.result
    if r and (r.status == "item_boomed" or r.status == "insufficient_meso") then
        core.log_error("SF stopped: " .. tostring(r.status))
        core.starforce.stop()
    end
end