05-03-26

Crafting Queue Lua Script

Automate crafting in your game with a Rebind Lua script. This script allows you to queue up recipes, set a delay, and even pause or cancel the process using hardware input.

rebindlua scriptcraftingqueueautomationhardware inputscript

Question

Crafting queue: execute recipe N times with delay

Rebind AI

luau
-- rebind: name=Crafting Queue

local cfg = UI.Schema({
    trigger = UI.Keybind("F9", { label = "Start Crafting" }),
    recipe_key = UI.Keybind("R", { label = "Recipe Key" }),
    quantity = UI.Slider(10, { min = 1, max = 100, label = "Quantity" }),
    delay_ms = UI.Slider(500, { min = 100, max = 5000, suffix = "ms", label = "Delay Between Recipes" }),
    stop_key = UI.Keybind("Escape", { label = "Stop" }),
})

local craftTask = nil

function OnDown(key)
    if key == cfg.trigger then
        craftTask = Run(function()
            for i = 1, cfg.quantity do
                if not Input.IsDown("LCtrl") then
                    HID.Press(cfg.recipe_key)
                    Sleep(cfg.delay_ms)
                else
                    Log.Info("Crafting paused at recipe " .. i)
                    break
                end
            end
            UI.Notify("Crafting complete!", "success")
            Log.Info("Crafted " .. cfg.quantity .. " recipes")
        end)
        UI.Notify("Crafting started", "info")
        return false
    end

    if key == cfg.stop_key and craftTask and craftTask:IsRunning() then
        craftTask:Cancel()
        UI.Notify("Crafting cancelled", "warning")
        return false
    end

    return true
end

function OnStop()
    if craftTask and craftTask:IsRunning() then
        craftTask:Cancel()
    end
end

function OnBlur()
    if craftTask and craftTask:IsRunning() then
        craftTask:Cancel()
    end
end

How it works:

  1. UI Config — Set the recipe key, quantity, and delay between crafts
  2. Crafting Loop — Press F9 to start. The script loops N times, pressing the recipe key and waiting for the configured delay
  3. Pause Control — Hold Ctrl while crafting to pause the queue gracefully
  4. Stop — Press Escape to cancel immediately
  5. Cleanup — Automatically stops the loop when you switch windows or close the script

The delay is per-recipe, so with quantity=10 and delay=500ms, the full run takes ~5 seconds. Adjust the delay to match your game's crafting animation timing.

Learn more: