• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ New equipment slot don't work

Helliot1

Owner of Empire Online
Joined
Jul 26, 2017
Messages
315
Solutions
1
Reaction score
58
What am I doing wrong?
I am trying to create new Slots, I followed this steps:

distance slot was added · EvilHero90/otclient@aff23ec · GitHub

and they are not working..

The inventory don't appears.

Inventory.lua

Lua:
InventorySlotStyles = {
  [InventorySlotHead] = "HeadSlot",
  [InventorySlotNeck] = "NeckSlot",
  [InventorySlotBack] = "BackSlot",
  [InventorySlotBody] = "BodySlot",
  [InventorySlotRight] = "RightSlot",
  [InventorySlotLeft] = "LeftSlot",
  [InventorySlotLeg] = "LegSlot",
  [InventorySlotFeet] = "FeetSlot",
  [InventorySlotFinger] = "FingerSlot",
  [InventorySlotAmmo] = "AmmoSlot",
  [InventorySlotBracers] = "BracersSlot",
  [InventorySlotGauntlets] = "GauntletsSlot"
}

Inventory.otui
Code:
InventoryItem < Item
  $on:
    image-source: /images/ui/item-blessed

HeadSlot < InventoryItem
  id: slot1
  image-source: /images/game/slots/head
  &position: {x=65535, y=1, z=0}
  $on:
    image-source: /images/game/slots/head-blessed

BodySlot < InventoryItem
  id: slot4
  image-source: /images/game/slots/body
  &position: {x=65535, y=4, z=0}
  $on:
    image-source: /images/game/slots/body-blessed

LegSlot < InventoryItem
  id: slot7
  image-source: /images/game/slots/legs
  &position: {x=65535, y=7, z=0}
  $on:
    image-source: /images/game/slots/legs-blessed

FeetSlot < InventoryItem
  id: slot8
  image-source: /images/game/slots/feet
  &position: {x=65535, y=8, z=0}
  $on:
    image-source: /images/game/slots/feet-blessed

NeckSlot < InventoryItem
  id: slot2
  image-source: /images/game/slots/neck
  &position: {x=65535, y=2, z=0}
  $on:
    image-source: /images/game/slots/neck-blessed

LeftSlot < InventoryItem
  id: slot6
  image-source: /images/game/slots/left-hand
  &position: {x=65535, y=6, z=0}
  $on:
    image-source: /images/game/slots/left-hand-blessed

FingerSlot < InventoryItem
  id: slot9
  image-source: /images/game/slots/finger
  &position: {x=65535, y=9, z=0}
  $on:
    image-source: /images/game/slots/finger-blessed

BackSlot < InventoryItem
  id: slot3
  image-source: /images/game/slots/back
  &position: {x=65535, y=3, z=0}
  $on:
    image-source: /images/game/slots/back-blessed

RightSlot < InventoryItem
  id: slot5
  image-source: /images/game/slots/right-hand
  &position: {x=65535, y=5, z=0}
  $on:
    image-source: /images/game/slots/right-hand-blessed

AmmoSlot < InventoryItem
  id: slot10
  image-source: /images/game/slots/ammo
  &position: {x=65535, y=10, z=0}
  $on:
    image-source: /images/game/slots/ammo-blessed
 
BracersSlot < InventoryItem
  id: slot11
  image-source: /images/game/slots/bracers
  &position: {x=65535, y=10, z=0}
  $on:
    image-source: /images/game/slots/bracers-blessed

GauntletsSlot < InventoryItem
  id: slot12
  image-source: /images/game/slots/gauntlets
  &position: {x=65535, y=10, z=0}
  $on:
    image-source: /images/game/slots/gauntlets-blessed
 

PurseButton < Button
  id: purseButton
  size: 26 26
  !tooltip: tr('Open purse')
  icon-source: /images/game/slots/purse
  icon-size: 24 24
  icon-offset: 1 1

MiniWindow
  id: inventoryWindow
  !text: tr('Inventory')
  icon: /images/topbuttons/inventory
  height: 175
  @onClose: modules.game_inventory.onMiniWindowClose()
  &save: true

  MiniWindowContents
    HeadSlot
      anchors.top: parent.top
      anchors.horizontalCenter: parent.horizontalCenter
      margin-top: 3

    BodySlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    LegSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    FeetSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    NeckSlot
      anchors.top: slot1.top
      anchors.right: slot1.left
      margin-top: 10
      margin-right: 5

    LeftSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    FingerSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    BackSlot
      anchors.top: slot1.top
      anchors.left: slot1.right
      margin-top: 10
      margin-left: 5

    RightSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    AmmoSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3
   
    BracersSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    GauntletsSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3   

    PurseButton
      margin-top: 3
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter

Player.lua
Lua:
InventorySlotOther = 0
InventorySlotHead = 1
InventorySlotNeck = 2
InventorySlotBack = 3
InventorySlotBody = 4
InventorySlotRight = 5
InventorySlotLeft = 6
InventorySlotLeg = 7
InventorySlotFeet = 8
InventorySlotFinger = 9
InventorySlotAmmo = 10
InventorySlotBracers = 11
InventorySlotGauntlets = 12
InventorySlotPurse = 13

InventorySlotFirst = InventorySlotHead
InventorySlotLast = InventorySlotPurse

Bump
 
Last edited:
Have you added that slot on your server?
Yea, I add on my server

Enums.h
C++:
enum ConditionId_t : int8_t {
    CONDITIONID_DEFAULT = -1,
    CONDITIONID_COMBAT,
    CONDITIONID_HEAD,
    CONDITIONID_NECKLACE,
    CONDITIONID_BACKPACK,
    CONDITIONID_ARMOR,
    CONDITIONID_RIGHT,
    CONDITIONID_LEFT,
    CONDITIONID_LEGS,
    CONDITIONID_FEET,
    CONDITIONID_RING,
    CONDITIONID_AMMO,
    CONDITIONID_BRACERS,
    CONDITIONID_GAUNTLETS,
};

Items.h
C++:
enum SlotPositionBits : uint32_t {
    SLOTP_WHEREEVER = 0xFFFFFFFF,
    SLOTP_HEAD = 1 << 0,
    SLOTP_NECKLACE = 1 << 1,
    SLOTP_BACKPACK = 1 << 2,
    SLOTP_ARMOR = 1 << 3,
    SLOTP_RIGHT = 1 << 4,
    SLOTP_LEFT = 1 << 5,
    SLOTP_LEGS = 1 << 6,
    SLOTP_FEET = 1 << 7,
    SLOTP_RING = 1 << 8,
    SLOTP_AMMO = 1 << 9,
    SLOTP_DEPOT = 1 << 10,
    SLOTP_TWO_HAND = 1 << 11,
    SLOTP_BRACERS = 1 << 12,
    SLOTP_GAUNTLETS = 1 << 13,
    SLOTP_HAND = (SLOTP_LEFT | SLOTP_RIGHT)
};

Items.cpp
C++:
            if (tmpStrValue == "head") {
                it.slotPosition |= SLOTP_HEAD;
            } else if (tmpStrValue == "body") {
                it.slotPosition |= SLOTP_ARMOR;
            } else if (tmpStrValue == "legs") {
                it.slotPosition |= SLOTP_LEGS;
            } else if (tmpStrValue == "feet") {
                it.slotPosition |= SLOTP_FEET;
            } else if (tmpStrValue == "backpack") {
                it.slotPosition |= SLOTP_BACKPACK;
            } else if (tmpStrValue == "two-handed") {
                it.slotPosition |= SLOTP_TWO_HAND;
            } else if (tmpStrValue == "right-hand") {
                it.slotPosition &= ~SLOTP_LEFT;
            } else if (tmpStrValue == "left-hand") {
                it.slotPosition &= ~SLOTP_RIGHT;
            } else if (tmpStrValue == "necklace") {
                it.slotPosition |= SLOTP_NECKLACE;
            } else if (tmpStrValue == "ring") {
                it.slotPosition |= SLOTP_RING;
            } else if (tmpStrValue == "ammo") {
                it.slotPosition |= SLOTP_AMMO;
            } else if (tmpStrValue == "hand") {
                it.slotPosition |= SLOTP_HAND;
            } else if (tmpStrValue == "bracers") {
                it.slotPosition |= SLOTP_BRACERS;
            } else if (tmpStrValue == "gauntlets") {
                it.slotPosition |= SLOTP_GAUNTLETS;
            } else {
                std::cout << "[Warning - Items::parseItemNode] Unknown slotType: " << valueAttribute.as_string() << std::endl;
            }

LuaScript.cpp
C++:
    // Use with itemType:getSlotPosition
    registerEnum(SLOTP_WHEREEVER)
    registerEnum(SLOTP_HEAD)
    registerEnum(SLOTP_NECKLACE)
    registerEnum(SLOTP_BACKPACK)
    registerEnum(SLOTP_ARMOR)
    registerEnum(SLOTP_RIGHT)
    registerEnum(SLOTP_LEFT)
    registerEnum(SLOTP_LEGS)
    registerEnum(SLOTP_FEET)
    registerEnum(SLOTP_RING)
    registerEnum(SLOTP_AMMO)
    registerEnum(SLOTP_DEPOT)
    registerEnum(SLOTP_TWO_HAND)
    registerEnum(SLOTP_BRACERS)
    registerEnum(SLOTP_GAUNTLETS)

Movement.cpp

C++:
MoveEvent* MoveEvents::getEvent(Item* item, MoveEvent_t eventType, slots_t slot)
{
    uint32_t slotp;
    switch (slot) {
        case CONST_SLOT_HEAD: slotp = SLOTP_HEAD; break;
        case CONST_SLOT_NECKLACE: slotp = SLOTP_NECKLACE; break;
        case CONST_SLOT_BACKPACK: slotp = SLOTP_BACKPACK; break;
        case CONST_SLOT_ARMOR: slotp = SLOTP_ARMOR; break;
        case CONST_SLOT_RIGHT: slotp = SLOTP_RIGHT; break;
        case CONST_SLOT_LEFT: slotp = SLOTP_LEFT; break;
        case CONST_SLOT_LEGS: slotp = SLOTP_LEGS; break;
        case CONST_SLOT_FEET: slotp = SLOTP_FEET; break;
        case CONST_SLOT_AMMO: slotp = SLOTP_AMMO; break;
        case CONST_SLOT_RING: slotp = SLOTP_RING; break;
        case CONST_SLOT_BRACERS: slotp = SLOTP_BRACERS; break;
        case CONST_SLOT_GAUNTLETS: slotp = SLOTP_GAUNTLETS; break;
        default: slotp = 0; break;
    }

Player.cpp
C++:
    const int32_t& slotPosition = item->getSlotPosition();
    if ((slotPosition & SLOTP_HEAD) || (slotPosition & SLOTP_NECKLACE) ||
            (slotPosition & SLOTP_BACKPACK) || (slotPosition & SLOTP_ARMOR) ||
            (slotPosition & SLOTP_LEGS) || (slotPosition & SLOTP_FEET) ||
            (slotPosition & SLOTP_BRACERS) || (slotPosition & SLOTP_GAUNTLETS) ||
            (slotPosition & SLOTP_RING)) {
        ret = RETURNVALUE_CANNOTBEDRESSED;
    } else if (slotPosition & SLOTP_TWO_HAND) {
        ret = RETURNVALUE_PUTTHISOBJECTINBOTHHANDS;
    } else if ((slotPosition & SLOTP_RIGHT) || (slotPosition & SLOTP_LEFT)) {
        if (!g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS)) {
            ret = RETURNVALUE_CANNOTBEDRESSED;
        } else {
            ret = RETURNVALUE_PUTTHISOBJECTINYOURHAND;
        }
    }
 
Last edited:
how does it looks brocould u post picture?(to get an ideaon how does it looks) im looking for add something as this as if my inventory is closed keep a squre opened example to fill arrows
 
When you say it doesn't work, can you explain how?

Do you see the slot in the client?
If yes, When you drag an item into the new slot, does it say anything? (Such as "Not possible.")
If this is a slot that can only have certain items in it, did you label the item so it can go into the slot? (Such as helmet slot can only have helmets, so you must label an item as a helmet before you can use this slot)
 
When you say it doesn't work, can you explain how?

Do you see the slot in the client?
If yes, When you drag an item into the new slot, does it say anything? (Such as "Not possible.")
If this is a slot that can only have certain items in it, did you label the item so it can go into the slot? (Such as helmet slot can only have helmets, so you must label an item as a helmet before you can use this slot)

The Slot don't show in Client...

when I login in my char, don't show the "Inventory"
 
Your gauntlets and Bracers have the same position as the ammo slot:
&position: {x=65535, y=10, z=0}

You'll probably need to change that to something new.
Like y=11 and y=12 or something.

You probably have other issues, but that's the first thing I know is wrong.
It probably works, you just haven't edited the inventory system so that you can see the slot in the client.
 
Your gauntlets and Bracers have the same position as the ammo slot:
&position: {x=65535, y=10, z=0}

You'll probably need to change that to something new.
Like y=11 and y=12 or something.

You probably have other issues, but that's the first thing I know is wrong.
It probably works, you just haven't edited the inventory system so that you can see the slot in the client.

Now I replace with it

Code:
BracersSlot < InventoryItem
  id: slot11
  image-source: /images/game/slots/bracers
  &position: {x=65535, y=15, z=0}
  $on:
    image-source: /images/game/slots/bracers-blessed

GauntletsSlot < InventoryItem
  id: slot12
  image-source: /images/game/slots/gauntlets
  &position: {x=65535, y=13, z=0}
  $on:
    image-source: /images/game/slots/gauntlets-blessed

But don't show the Inventory yet

Bump
 
Last edited by a moderator:
as i remember there was extra functions that gets inventory from player. i think it was in player.cpp or player.h there was loop that gets the number of max inventory slot try to search in this files "inventory" and you will find it
 
as i remember there was extra functions that gets inventory from player. i think it was in player.cpp or player.h there was loop that gets the number of max inventory slot try to search in this files "inventory" and you will find it

Doesn't matter,
You should be able to see the inventory slots in the OTClient without doing anything in TFS.

Until you fix the OTClient where you can see the inventory slots in the inventory window you won't be able to test or do anything.
 
if it is inventory slot it probably have grayed item background(or maybe no png linked thats why its invisible) while the item is null ,can be confused with no slot. Anyways without this changes in players.cpp and iologindata.cpp with load index of slots, he wont see any contain of this slot i had the same problem
 
check the otclient console, and look what is crashing the inventory module

Sorry for the wait, I was busy this week

Error:
Code:
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:

My Inventory.Lua
Lua:
InventorySlotStyles = {
  [InventorySlotHead] = "HeadSlot",
  [InventorySlotNeck] = "NeckSlot",
  [InventorySlotBack] = "BackSlot",
  [InventorySlotBody] = "BodySlot",
  [InventorySlotRight] = "RightSlot",
  [InventorySlotLeft] = "LeftSlot",
  [InventorySlotLeg] = "LegSlot",
  [InventorySlotFeet] = "FeetSlot",
  [InventorySlotFinger] = "FingerSlot",
  [InventorySlotAmmo] = "AmmoSlot",
  [InventorySlotBracers] = "BracersSlot",
  [InventorySlotGauntlets] = "GauntletsSlot"
}

inventoryWindow = nil
inventoryPanel = nil
inventoryButton = nil
purseButton = nil

function init()
  connect(LocalPlayer, {
    onInventoryChange = onInventoryChange,
    onBlessingsChange = onBlessingsChange
  })
  connect(g_game, { onGameStart = refresh })

  g_keyboard.bindKeyDown('Ctrl+I', toggle)

  inventoryButton = modules.client_topmenu.addRightGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', '/images/topbuttons/inventory', toggle)
  inventoryButton:setOn(true)

  inventoryWindow = g_ui.loadUI('inventory', modules.game_interface.getRightPanel())
  inventoryWindow:disableResize()
  inventoryPanel = inventoryWindow:getChildById('contentsPanel')

  purseButton = inventoryPanel:getChildById('purseButton')
  local function purseFunction()
    local purse = g_game.getLocalPlayer():getInventoryItem(InventorySlotPurse)
    if purse then
      g_game.use(purse)
    end
  end
  purseButton.onClick = purseFunction

  refresh()
  inventoryWindow:setup()
end

function terminate()
  disconnect(LocalPlayer, {
    onInventoryChange = onInventoryChange,
    onBlessingsChange = onBlessingsChange
  })
  disconnect(g_game, { onGameStart = refresh })

  g_keyboard.unbindKeyDown('Ctrl+I')

  inventoryWindow:destroy()
  inventoryButton:destroy()
end

function toggleAdventurerStyle(hasBlessing)
  for slot = InventorySlotFirst, InventorySlotLast do
    local itemWidget = inventoryPanel:getChildById('slot' .. slot)
    if itemWidget then
      itemWidget:setOn(hasBlessing)
    end
  end
end

function refresh()
  local player = g_game.getLocalPlayer()
  for i = InventorySlotFirst, InventorySlotPurse do
    if g_game.isOnline() then
      onInventoryChange(player, i, player:getInventoryItem(i))
    else
      onInventoryChange(player, i, nil)
    end
    toggleAdventurerStyle(player and Bit.hasBit(player:getBlessings(), Blessings.Adventurer) or false)
  end

  purseButton:setVisible(g_game.getFeature(GamePurseSlot))
end

function toggle()
  if inventoryButton:isOn() then
    inventoryWindow:close()
    inventoryButton:setOn(false)
  else
    inventoryWindow:open()
    inventoryButton:setOn(true)
  end
end

function onMiniWindowClose()
  inventoryButton:setOn(false)
end

-- hooked events
function onInventoryChange(player, slot, item, oldItem)
  if slot > InventorySlotPurse then return end

  if slot == InventorySlotPurse then
    if g_game.getFeature(GamePurseSlot) then
      purseButton:setEnabled(item and true or false)
    end
    return
  end

  local itemWidget = inventoryPanel:getChildById('slot' .. slot)
  if item then
    itemWidget:setStyle('InventoryItem')
    itemWidget:setItem(item)
  else
    itemWidget:setStyle(InventorySlotStyles[slot])
    itemWidget:setItem(nil)
  end
end

function onBlessingsChange(player, blessings, oldBlessings)
  local hasAdventurerBlessing = Bit.hasBit(blessings, Blessings.Adventurer)
  if hasAdventurerBlessing ~= Bit.hasBit(oldBlessings, Blessings.Adventurer) then
    toggleAdventurerStyle(hasAdventurerBlessing)
  end
end


Bump
 
Last edited by a moderator:
id of slot and value of y should be same as slot number from the otclient player.lua file where did you get that 15 from?
Code:
BracersSlot < InventoryItem
  id: slot11
  image-source: /images/game/slots/bracers
  &position: {x=65535, y=11, z=0}
  $on:
    image-source: /images/game/slots/bracers-blessed
GauntletsSlot < InventoryItem
  id: slot12
  image-source: /images/game/slots/gauntlets
  &position: {x=65535, y=12, z=0}
  $on:
    image-source: /images/game/slots/gauntlets-blessed
 
dded some tiles to my client, but I have a question.

id of slot and value of y should be same as slot number from the otclient player.lua file where did you get that 15 from?
Code:
BracersSlot < InventoryItem
  id: slot11
  image-source: /images/game/slots/bracers
  &position: {x=65535, y=11, z=0}
  $on:
    image-source: /images/game/slots/bracers-blessed
GauntletsSlot < InventoryItem
  id: slot12
  image-source: /images/game/slots/gauntlets
  &position: {x=65535, y=12, z=0}
  $on:
    image-source: /images/game/slots/gauntlets-blessed

Where is this 15 ?
 
Now I replace with it

Code:
BracersSlot < InventoryItem
  id: slot11
  image-source: /images/game/slots/bracers
  &position: {x=65535, y=15, z=0}
  $on:
    image-source: /images/game/slots/bracers-blessed

GauntletsSlot < InventoryItem
  id: slot12
  image-source: /images/game/slots/gauntlets
  &position: {x=65535, y=13, z=0}
  $on:
    image-source: /images/game/slots/gauntlets-blessed

But don't show the Inventory yet

Bump
your last send inventory.otui
 
your last send inventory.

Haha I changed it now to:
Lua:
BracersSlot < InventoryItem
  id: slot11
  image-source: /images/game/slots/bracers
  &position: {x=65535, y=11, z=0}
  $on:
    image-source: /images/game/slots/bracers-blessed

GauntletsSlot < InventoryItem
  id: slot12
  image-source: /images/game/slots/gauntlets
  &position: {x=65535, y=12, z=0}
  $on:
    image-source: /images/game/slots/gauntlets-blessed

But don't show my inventory again
show this error in otclient console

Code:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>

/game_inventory/inventory.lua:88: attempt to index global 'inventoryWindow' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:88: in function 'callback'
    /client_topmenu/topmenu.lua:31: in function </client_topmenu/topmenu.lua:29>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:88: attempt to index global 'inventoryWindow' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:88: in function 'callback'
    /client_topmenu/topmenu.lua:31: in function </client_topmenu/topmenu.lua:29>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:88: attempt to index global 'inventoryWindow' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:88: in function 'callback'
    /client_topmenu/topmenu.lua:31: in function </client_topmenu/topmenu.lua:29>
 
Last edited:
send the first errors becouse these are linked to closing window

Code:
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:308: in function 'onHealthChange'
    /game_skills/skills.lua:204: in function </game_skills/skills.lua:195>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:372: in function </game_skills/skills.lua:371>
ERROR: Unable to load texture '/images/game/skulls/skull_red': unable to open file '/images/game/skulls/skull_red.png': O sistema não pode encontrar o caminho especificado.
ERROR: invalid effect id 0
at:
    [C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:111: attempt to index global 'inventoryPanel' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:111: in function </game_inventory/inventory.lua:101>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:308: in function </game_skills/skills.lua:307>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:322: in function </game_skills/skills.lua:321>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:77: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:77: in function 'resetSkillColor'
    /game_skills/skills.lua:175: in function 'checkAlert'
    /game_skills/skills.lua:327: in function </game_skills/skills.lua:326>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:313: in function </game_skills/skills.lua:312>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:338: in function </game_skills/skills.lua:330>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:318: in function </game_skills/skills.lua:317>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:393: in function </game_skills/skills.lua:392>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:91: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:91: in function 'setSkillBase'
    /game_skills/skills.lua:400: in function </game_skills/skills.lua:399>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:393: in function </game_skills/skills.lua:392>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:91: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:91: in function 'setSkillBase'
    /game_skills/skills.lua:400: in function </game_skills/skills.lua:399>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:107: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:107: in function 'setSkillValue'
    /game_skills/skills.lua:393: in function </game_skills/skills.lua:392>
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:91: attempt to index local 'skill' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_skills/skills.lua:91: in function 'setSkillBase'
    /game_skills/skills.lua:400: in function </game_skills/skills.lua:399>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:88: attempt to index global 'inventoryWindow' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:88: in function 'callback'
    /client_topmenu/topmenu.lua:31: in function </client_topmenu/topmenu.lua:29>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:88: attempt to index global 'inventoryWindow' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:88: in function 'callback'
    /client_topmenu/topmenu.lua:31: in function </client_topmenu/topmenu.lua:29>
ERROR: protected lua call failed: LUA ERROR:
/game_inventory/inventory.lua:88: attempt to index global 'inventoryWindow' (a nil value)
stack traceback:
    [C]: in function '__index'
    /game_inventory/inventory.lua:88: in function 'callback'
    /client_topmenu/topmenu.lua:31: in function </client_topmenu/topmenu.lua:29>
 
if you dont made any change in otclient source and fucked it up than the problem is on server side. Search in server source files player.cpp and iologindata.cpp all of " intentory[ " and check the loop is pointed to SLOT_LAST or number, while it is number add 2 to it ex.
Code:
    for(int32_t slotId = 1; slotId < 12; ++slotId)
to
Code:
    for(int32_t slotId = 1; slotId < 14; ++slotId)
also player.h
Code:
        bool inventoryAbilities[13];
        Item* inventory[13];
 
Back
Top