Add this to vbot.lua // Dodaj to do vbot.lua
-- Count items without taking equipment in account // Only open backpacks
function itemAmountNoEQ(id)
local totalItemCount = 0
for _, container in pairs(getContainers()) do
if not container:getName():lower():find("depot") and not container:getName():lower():find("your inbox") then
for _, item in ipairs(container:getItems()) do
totalItemCount = item:getId() == id and totalItemCount +
item:getCount() or totalItemCount
end
end
end
return totalItemCount -- return total amount of items in backpack
end
Add this to ingame scripts or somewhere so it will be executed "ONCE" // Dodaj to do "ingame scripts" lub gdzieś gdzie bedzie to wykonane tylko "RAZ"
-- macro to auto replace currency per 100 ms
macro(100, "Auto Currency Replacer", function()
local itemCounter = {}
itemCounter[3031] = itemAmountNoEQ(3031) -- gold coins
itemCounter[3035] = itemAmountNoEQ(3035) -- platinum coins
itemCounter[3043] = itemAmountNoEQ(3043) -- crystal coins
itemCounter[3042] = itemAmountNoEQ(3042) -- scara coin (propably not used in this server - but whatever)
itemCounter[3040] = itemAmountNoEQ(3040) -- gold nugget
-- to add more coins do as examples above :)
local skipCrystal = false;
for i, container in pairs(getContainers()) do
for j, item in ipairs(container:getItems()) do
if itemCounter[item:getId()] then
if item:getCount() == 100 then
if(not item:getId() == 3043) then -- it its not crystal coins do as always
g_game.use(item)
else -- its crystal coins
if(itemCounter[item:getId()] > 100) then -- if total amount of coins from open bags is greater then 100 proceed
if(skipCrystal) then -- always skip first crystal that is 100 (used to pay for staff somewhere i leaved this code)
g_game.use(item)
else
skipCrystal = true
end
end
end
end
end
end
end
end)
Hope i help
// Mam nadzieje że pomogłem