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:
  • 0 Vote(s) - 0 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.

If find any bug, please, send a private message and i will fix the script.

#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:
Quote:001 Node (label this as "start")
002 Node
003 Node
004 Node
005 Action (use the script here to check your cap.)
006 Node (If you cap lower than "100", the Cavebot will go to this waypoints because it's the next. So this should be the waypoint that leaves the respawn or do whatever you wanna do when you have low cap.)

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


Go to a specific label if cap and/or supply is lower than X.
This script is useful to be used on hunts on respawns that are big, so you will not waste supplies or time to keep hunting because you don't have enough cap to loot more items.
I recommend to use this Action in the middle of some waypoints that walks around the respawn.

Capacity Checker
if cap() < 100 then
   gotolabel('leave')
   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('leave')
   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 or itemcount(SUPPLY_NAME, SUPPLY_BP) < SUPPLY_MIN then
   gotolabel('leave')
   return
end

Waypoints example:
Quote:001 Node
002 Node
003 Node
004 Node
005 Node
006 Node
007 Action (use the script here to check your cap. If it's lower than 100, it will not keep hunting, but go to waypoint labeled as "leave")
008 Node
009 Node
010 Node
011 Node
012 Node
013 Node
014 Action (probably a script to check cap or supplies and back to first waypoint)
015 Node (label this as "leave"; If you cap lower than "100" this script will make the Cavebot go to this waypoint. So this should be the waypoint that leaves the respawn or do whatever you wanna do when you have low cap.)

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' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
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 --]]

local startWindowsCount = windowcount()
local currentWindowsCount = -1

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

    currentWindowsCount = windowcount()

    if currentWindowsCount > startWindowsCount then
        break
    end
end

if currentWindowsCount > startWindowsCount then

    table.id(ItemsDrop)

    local bagIndex = currentWindowsCount - 1

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

    local bagContainer = tempOpenNextContainer(getcontainer(bagIndex))
    if bagContainer ~= nil and bagContainer.maxslots ~= nil then
        emptyLeft = bagContainer.maxslots - bagContainer.usedslots
        if emptyLeft > 0 then
            for i,j in ipairs(ItemsDrop) do
                if table.find(ItemsDrop, j) ~= nil then
                    while itemcount(j, 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
                            end
                        end
                        moveitems(j, bagContainer.index, BackpackLoot, 100)
                        wait(300)
                        emptyLeft = emptyLeft - 1
                    end
                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. Smile

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
[Image: fdGEyp8.png]


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('depot')
wait(500)
openitem('depot')
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
Talk to NPC and buy ammo

This will buy the ammo based on the maxAmount, your capacity and current money..

Code
local Ammo = {
   Name = 'arrow',
   MaxAmount = 400,
   Price = 2,
   Weight = 0.7,
}

local DestinationBP = 'grey backpack'

local GOLD_COIN_ID = 2148
local PLATINUM_COIN_ID = 2152
local CRYSTAL_COIN_ID = 2160


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

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

   if AmountToBuy > 0 then
       local currentMoney = itemcount(GOLD_COIN_ID) + (itemcount(PLATINUM_COIN_ID) * 100) + (itemcount(CRYSTAL_COIN_ID) * 10000)
       local moneyNeeded = math.ceil(Ammo.Price * AmountToBuy) --Platinums to withdraw.
       if currentMoney > moneyNeeded then
           say('hi')
           wait(800)
           say('buy ' .. AmountToBuy .. ' ' .. Ammo.Name)
           wait(800)
           say('yes')
           wait(800)
       end
   end
end



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016