Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
86
Ammo Slot Counter Label #63
This adds a label to the rightSlot so you can count your ammo.
This is only an example but it works for burst arrows.
888b | 32 lines.
local ammoLabel = nil
macro(200, "count", function()
    local count = 0
    if getRight() then
        if getRight():getId() == 35849 then -- red quiver
            count = player:getItemsCount(3449) -- burst arrow
        elseif getRight():getId() == 35848 then -- blue quiver
            count = player:getItemsCount(3448) -- poison arrow
        end
    end
    ammoLabel:setText(count > 0 and count or "")
end)

quiverSlot = modules.game_inventory.inventoryWindow:recursiveGetChildById('slot5')
ammoLabel = quiverSlot:getChildById("AmmoLabel")

if not ammoLabel then
    ammoLabel = g_ui.loadUIFromString([[
Label
  color: #5ff7f7
  background-color: #00000055
  opacity: 0.87
  anchors.left: parent.left
  anchors.right: parent.right
  anchors.bottom: parent.bottom
  text-align: right
  margin-right: 3
  margin-left: 3
  text:
]], quiverSlot)
    ammoLabel:setId("AmmoLabel")
end

10 Oct 2021