Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FREE Useful Scripts for Cavebotting
#1
Hello.

I'm posting this thread to share common LUA scripts that are useful for specifically Caveboting.

Pay attention where you should use the script. Because some scripts may be require another code to be used Cavebot->LUA Setup, in that case, I will share both.

I'm sure the scripts works, so i will give any support. If you need any improvement or so, unfortunately you will have to do it on your own.

#2
Capacity and/or Supply checker

Go to a specific label if cap and/or supply is HIGHER than X.
This script is useful to be used on hunts to check your cap before going to know if you should go another round on the respawn or leave.

I recommend to use this Action after all waypoints that walks around the respawn. So you just need to setup the first waypoint that walks around the respawn as "start", it will go back to "start" if cap is enough and keep hunting.

Capacity Checker
if cap() >= 100 then
    gotolabel('start')
    return
end

Supply Checker
If you are using "Healer->Open next BP for more supply" then it's not useful, because it will not detect when you have more inside the backpack.
Cavebot->LUA Setup
SUPPLY_NAME = 'ultimate healing rune'
SUPPLY_BP = 'blue backpack'
SCRIPT
if itemcount(SUPPLY_NAME, SUPPLY_BP) >= SUPPLY_MIN then
    gotolabel('start')
    return
end

Supply and Capacity Checker
If you are using "Healer->Open next BP for more supply" then it's not useful, because it will not detect when you have more inside the backpack.
Cavebot->LUA Setup
SUPPLY_NAME = 'ultimate healing rune'
SUPPLY_BP = 'blue backpack'
SUPPLY_MIN = 10

CAP_MIN = 100

SCRIPT
if cap() >= CAP_MIN and itemcount(SUPPLY_NAME, SUPPLY_BP) >= SUPPLY_MIN then
    gotolabel('start')
    return
end

Waypoints example:
|Only Registered members can see download links. | Click here to buy subscription or here to register.

So it will walk on waypoints 001 to 006 and when it reaches the "007", it will check for your capacity. If it's lower than "100", it will go to waypoint "015 Node", otherwise it will go back to "001 Node 'start'".

#3
Drop loot inside a container (backpack, bag, etc.)

This script will open the container and drop items inside. If there's no available slot, it will keep opening next containers searching for an available slot.
It's useful on hunts that you wanna have a "loot bag". It will save sometime because you will not need to pickup every item later and it will not look like a botter.

I recommend to keep the container hidden somewhere away from monster respawns, because if a monster dies there or anybody drops any item (like a gold coin) over it, it will not remove the item to open the container.

local ItemsDrop = { 'fish', 'battle shield', 'wooden shield' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'Red Backpack' -- Name or index. Index is recommended. It will drop loots FROM this backpack. If you choose to use name then you MUST NOT have the same kind backpack (even if inside another) on floor.
local DropBagPosition = { X = 12345, Y = 54321, Z = 7 } -- Container's location that you wanna open and drop items inside.

--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]

if findopenedcontainer == nil then
    function findopenedcontainer(lastContainers, currentContainers, openedContainerId)
        if currentContainers == nil then
            currentContainers = getcontainers()
        end
        if openedContainerId == nil then
            openedContainerId = -1
        end

        for _, current in ipairs(currentContainers) do
            local found = false
            for __, last in ipairs(lastContainers) do
                if last.index == current.index then
                    found = true
                    break
                end
            end
            if found == false and (openedContainerId <= 0 or openedContainerId == current.id) then
                return current
            end
        end
        return nil
    end
end

if opencontainer == nil then
    function opencontainer(id, from, newWindow, tries)
        if newWindow == nil then
            newWindow = false
        end
        if tries == nil then
            tries = 3
        end

        local containersBefore = getcontainers()

        local openedContainer = nil
        for j = 1, tries do
            openitem(id, from, newWindow)
            wait(800, 1200)
            local containersCurrent = getcontainers()
            openedContainer = findopenedcontainer(containersBefore, containersCurrent, id)
            if openedContainer ~= nil and openedContainer.index >= 0 then
                break
            end
            containersBefore = containersCurrent
        end
        return openedContainer
    end
end

if tempOpenNextContainer == nil then
    function tempOpenNextContainer(cont)
        local emptyLeft = cont.maxslots - cont.usedslots
        while emptyLeft == 0 do
            for _, bagItem in ipairs(cont.items) do
                if itemhasflags(bagItem.id, 4) then
                    openitem(bagItem.id, cont.index)
                    wait(1000)
                    cont = getcontainer(cont.index)
                    if cont ~= nil and cont.maxslots ~= nil then
                        emptyLeft = cont.maxslots - cont.usedslots
                        break
                    else
                        return
                    end
                end
                emptyLeft = -1
            end
        end
        if emptyLeft > 0 then
            return cont
        end
        return nil
    end
end

local bagContainer = opencontainer(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
if bagContainer ~= nil then
    bagContainer = tempOpenNextContainer(bagContainer)
    if bagContainer ~= nil then
        emptyLeft = bagContainer.maxslots - bagContainer.usedslots
        if emptyLeft > 0 then
            table.id(ItemsDrop)
            for i,j in ipairs(ItemsDrop) do
                local failCount = 0
                while itemcount(j, BackpackLoot) > 0 do
                    if emptyLeft == 0 then
                        bagContainer = tempOpenNextContainer(bagContainer)
                        if bagContainer ~= nil and bagContainer.maxslots ~= nil then
                            emptyLeft = bagContainer.maxslots - bagContainer.usedslots
                        end
                    end
                    if moveitems(j, bagContainer.index, BackpackLoot, 100) then
                        wait(300)
                        emptyLeft = emptyLeft - 1
                    else
                        wait(300)
                        failCount = failCount + 1
                        if failCount > 3 then
                            break
                        end
                    end
                end
            end
        end
    end
end
local ItemsDrop = { 'dwarven shield', 'battle shield', 'halberd', 'wooden shield' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'Red Backpack' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
local DropBagPosition = { X = 12345, Y = 54321, Z = 6 } -- Container's location that you wanna open and drop items inside.

--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]

local startWindowsCount = windowcount()
local currentWindowsCount = -1

for i = 0, 5 do
    openitem(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
    wait(1000, 1200)

    currentWindowsCount = windowcount()
    if currentWindowsCount > startWindowsCount then
        break
    end
end

if currentWindowsCount > startWindowsCount then

    table.id(ItemsDrop)

    local bagIndex = currentWindowsCount - 1
    local bagContainer = getcontainer(bagIndex)

    if tempOpenNextContainer == nil then
        function tempOpenNextContainer(bagContainer)
            if bagContainer ~= nil and bagContainer.maxslots > 0 then
                while bagContainer.maxslots == bagContainer.usedslots and bagContainer.maxslots > 0 do
                    local foundContainer = false
                    for _, bagItem in ipairs(bagContainer.items) do
                        if itemhasflags(bagItem.id, 4) then
                            foundContainer = true
                            openitem(bagItem.id, bagContainer.index)
                            wait(1200, 1500)
                            bagContainer = getcontainer(bagContainer.index)
                            break
                        end
                    end
                    if foundContainer == false then
                        break
                    end
                end
            end

            return bagContainer
        end
    end

    bagContainer = tempOpenNextContainer(bagContainer)
    if bagContainer ~= nil and bagContainer.maxslots ~= nil then
        emptyLeft = bagContainer.maxslots - bagContainer.usedslots
        if emptyLeft > 0 then
            for _, item in ipairs(ItemsDrop) do
                while itemcount(item, BackpackLoot) > 0 do
                    if emptyLeft == 0 then
                        bagContainer = tempOpenNextContainer(getcontainer(bagContainer.index))
                        if bagContainer ~= nil and bagContainer.maxslots ~= nil then
                            emptyLeft = bagContainer.maxslots - bagContainer.usedslots
                            if emptyLeft == 0 then
                                break
                            end
                        end
                    end
                    moveitems(item, bagContainer.index, BackpackLoot, 100)
                    wait(300)
                    emptyLeft = emptyLeft - 1
                end
            end
        end
    end
end

#4
Depositer

This script will reach the Locker, open it, open the loots backpack then:
1. Open not stackable backpack and move items FROM your loot backpack to the backpacks that are inside it.
2. Back to loots backpack and open stackable backpack and move items FROM your loot backpack there.
It's useful to make afk scripts.
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Smile" title="Smile" class="smilie smilie_1" />

1. Introduction
This script is very useful for refillers and it will split loots in "stacked" and "non stacked" backpacks.
"Stacked"
You will have a single backpack that will be opened and all stackeds will be moved to.
"Non Stacked"
You will have a single backpack with 20 backpacks inside that all non stackeds will be moved to.


2. How to organize backpacks
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.loading="lazy" alt="[Image: fdGEyp8.png]" class="mycode_img" />


3. Code
local CHARACTER_LOOT_BP = 'backpack'

local DEPOSITER_LOOT_MAIN_BP = 'green backpack'
local DEPOSITER_LOOT_ITEMS_BP = 'green backpack'
local DEPOSITER_STACKED_BP = 'yellow parcel'

local ITEMS_LOOT = { 'battle shield', 'battle shield', 'dwarven shield' }
local ITEMS_STACKED = { 'bolt', 'hunting bolt' }



reachgrounditem('locker')
wait(500)
openitem('locker')
wait(1000)

if itemcount(DEPOSITER_LOOT_MAIN_BP, 'Locker') > 0 then

    local DEPOSITER_LOOT_WINCOUNT = windowcount(DEPOSITER_LOOT_MAIN_BP)

    openitem(DEPOSITER_LOOT_MAIN_BP, 'Locker')
    wait(1000)

    if windowcount(DEPOSITER_LOOT_MAIN_BP) > DEPOSITER_LOOT_WINCOUNT then

        if itemcount(DEPOSITER_LOOT_ITEMS_BP, DEPOSITER_LOOT_MAIN_BP) > 0 then

            clearlastonto()

            for i = 0, #ITEMS_LOOT do
                while itemcount(ITEMS_LOOT[i], CHARACTER_LOOT_BP) > 0 do
                    moveitemsonto(ITEMS_LOOT[i], DEPOSITER_LOOT_ITEMS_BP, getlastonto(), DEPOSITER_LOOT_MAIN_BP, CHARACTER_LOOT_BP, 100)
                    wait(500)
                end
            end

        end

        higherwindow(DEPOSITER_LOOT_MAIN_BP)
        wait(1000)

    end

end

if itemcount(DEPOSITER_STACKED_BP, 'Locker') > 0 then
    
    local DEPOSITER_STACKED_WINCOUNT = windowcount(DEPOSITER_STACKED_BP)

    openitem(DEPOSITER_STACKED_BP, 'Locker')
    wait(1000)

    if windowcount(DEPOSITER_STACKED_BP) > DEPOSITER_STACKED_WINCOUNT then

        stackitems(DEPOSITER_STACKED_BP, false)

        for i = 0, #ITEMS_STACKED do
            while itemcount(ITEMS_STACKED[i], CHARACTER_LOOT_BP) > 0 do

                moveitems(ITEMS_STACKED[i], DEPOSITER_STACKED_BP, CHARACTER_LOOT_BP, 100)
                wait(500)

            end
        end
        
    end

end

#5
Withdraw money to buy ammo

This script will withdraw the required amount to purchase ammo based on your capacity and max amount set.
It will take PLATINUM COINS ONLY.

THIS SCRIPT WILL NOT REACH LOCKER OR OPEN IT!!
Code
local Ammo = {
    Name = 'arrow',
    MaxAmount = 400,
    Price = 2,
    Weight = 0.7,
}

local DestinationBP = 'grey backpack'
local TakeFromWindow = 'locker'

if windowcount(DestinationBP) > 0 and windowcount(TakeFromWindow) > 0 then

    local AmountToBuy = cap() / Ammo.Weight
    if AmountToBuy > Ammo.MaxAmount then
        AmountToBuy = Ammo.MaxAmount
    end

    local platinumsNeeded = math.ceil((Ammo.Price * (AmountToBuy - itemcount(Ammo.Name, true))) / 100) --Platinums to withdraw.

    local currentPlatinums = itemcount(2152, DestinationBP, true)

    while currentPlatinums < platinumsNeeded and itemcount(2152, TakeFromWindow, false) >= platinumsNeeded do
        moveitems(2152, DestinationBP, TakeFromWindow, (platinumsNeeded - currentPlatinums))
        wait(500)
        currentPlatinums = itemcount(2152, DestinationBP, true)
    end
end

#6
Withdraw money to buy ammo

This script will withdraw the required amount to purchase ammo based on your capacity and max amount set.
It will take PLATINUM COINS ONLY.

THIS SCRIPT WILL NOT REACH LOCKER OR OPEN IT!!
Code
local Ammo = {
    Name = 'arrow',
    MaxAmount = 400,
    Price = 2,
    Weight = 0.7,
}

local DestinationBP = 'grey backpack'
local TakeFromWindow = 'locker'

if windowcount(DestinationBP) > 0 and windowcount(TakeFromWindow) > 0 then

    local AmountToBuy = math.floor(cap() / Ammo.Weight)
    if AmountToBuy > Ammo.MaxAmount then
        AmountToBuy = Ammo.MaxAmount
    end

    AmountToBuy = math.floor(AmountToBuy)

    local platinumsNeeded = math.ceil((Ammo.Price * (AmountToBuy - itemcount(Ammo.Name, true))) / 100) --Platinums to withdraw.

    local currentPlatinums = itemcount(2152, DestinationBP, true)

    while currentPlatinums < platinumsNeeded and itemcount(2152, TakeFromWindow, false) >= platinumsNeeded do
        moveitems(2152, DestinationBP, TakeFromWindow, (platinumsNeeded - currentPlatinums))
        wait(500)
        currentPlatinums = itemcount(2152, DestinationBP, true)
    end
end


Or this code for bank's npc.
local Ammo = {
   Name = 'arrow',
   MaxAmount = 400,
   Price = 2,
   Weight = 0.7,
}

local DestinationBP = 'grey backpack'

if windowcount(DestinationBP) > 0 then
   local AmountToBuy = math.floor(cap() / Ammo.Weight)
   if AmountToBuy > Ammo.MaxAmount then
       AmountToBuy = Ammo.MaxAmount
   end

   AmountToBuy = math.floor(AmountToBuy - itemcount(Ammo.Name, true))

   if AmountToBuy > 0 then
       local currentMoney = itemcount('gold coin') + (itemcount('platinum coin') * 100) + (itemcount('crystal coin') * 10000)
       local moneyNeeded = math.ceil(Ammo.Price * AmountToBuy) --Platinums to withdraw.
       if currentMoney < moneyNeeded then
           say('hi')
           wait(800, 1200)
           say('withdraw ' .. (moneyNeeded - currentMoney))
           wait(800, 1200)
           say('yes')
           wait(800, 1200)
       end
   end
end

#7
Simple gold changer

This script will simply try to change gold coins by saying 'hi'-'change gold'-'count'-'yes' then check if it was changed based on gold coins on opened containers and capacity.
It will try 5 times, after that it will play a sound, flash client and disable CAVEBOT.
If it fails once, the script will check if there's a player on screen and wait 5 seconds to try again.

THIS SCRIPT WILL NOT REACH THE BANK NPC OR SO!!
Code
local deposited_money = false
for i=1,5 do
    local gold_count = itemcount('gold coin', '', true)
    local platinum_count = math.floor(gold_count / 100)

    if platinum_count > 0 then
        say('hi')
        wait(800, 1300)
        say('change gold')
        wait(800, 1300)
        say(platinum_count)
        wait(800, 1300)
        say('yes')
        wait(800, 1300)

        if itemcount('gold coin', '', true) < gold_count then
            deposited_money = true
            break
        elseif cap() > start_capacity then
            deposited_money = true
            break
        else
            if paround() > 0 then
                wait(5000)
            end
        end
    end
end

if deposited_money == false then
    playsound('default')
    flashclient()
    setsettings('Cavebot/Enabled', false)
end



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016