Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetCraftingBackPackSlots

From RoR Wiki

UI Lua API · Crafting functions
Version: WAR 1.4.8

Returns, for each filled crafting slot of a trade skill, the backpack slot the item came from.

sources = GetCraftingBackPackSlots(tradeSkill)

Arguments

tradeSkill
number – A GameData.TradeSkills value. The stock UI uses APOTHECARY (4) and TALISMAN (5).

Returns

sources
table – Table keyed by crafting slot, 0 to 7, the same keys as GetCraftingData. Crafting slots whose source is not in the inventory or crafting backpack have no entry.

Each entry has these fields:

Key Type Meaning
slot number Slot inside the backpack, starting at 1.
backpack number 2 for the main inventory or 4 for the crafting backpack (EA_Window_Backpack.TYPE_INVENTORY / TYPE_CRAFTING).

Details

  • Only items from the main inventory (slots 1–80) and the crafting backpack (slots 1–80) are reported.
  • The table can have gaps. The stock UI stops at the first missing index.
  • Nothing is returned for trade skill 0 or 7, or if there is no player object or the Lua state is not available. Other values are not range-checked.
  • Exactly one argument must be passed.

Errors

None besides the generic Invalid Parameters message when the argument is missing or not a number.

Example

From default/ea_craftingwindow/source/talismanmakingwindow.lua:

local backpackSlots = GetCraftingBackPackSlots( GameData.TradeSkills.TALISMAN )
...
for index = 0, TalismanMakingWindow.maxResources
do
    if( not backpackSlots[index] )
    then
        break
    end
    local backpackSlot = backpackSlots[index].slot
    local backpackType = backpackSlots[index].backpack

See also