Cavebotting

What is cavebotting?

When people talk about cavebotting it means that the bot does everything for you while hunting. This can be as simple as only hunting in a cave, or with supplying, depositing, selling items all at once. The latter form is also called "full AFK botting." 
Within the OTClientV8 BOT, cavebotting is possible from the get go. What you need for a basic script are the "Cave" and "HP" tab.
An example of a setup for Yalahar dragons is shown below.

Waypoints

For a cavebot to work successfully it needs waypoints. Waypoints will bring the character from one point to another. To do this with the OTClientV8 BOT you simply start with the "Add" button. This will bring up a screen as shown below:

Here you can already see it got a name which is "Config name," you can adjust this to the name you prefer. In the example earlier it's called Yala-dragons. It's normal to name the waypoints after the location and what creature you are mainly going to hunt. This can also be extended with the vocation if you prefer. But because this bot has configuration sets, you can make a whole config for each vocation and therefor it's not needed to add the vocation. Also there is already a label called "start." This usability of labels will be explained later.

To know more about configs check the page "Basics Create Config."

 

Waypoint buttons

Once you made your waypoint config you can start with filling up the waypoints. The following buttons are available to use:

This button will give you a popup like below, here you can see your current location in X, Y, Z format. In tibia all tiles are placed on a grid and each tile is addressable with the right combination of numbers.
The first number is for the horizontal axis. If you add 1 it means you will go 1 more tile to the east(right).
The second number is for the vertical axis. If you add 1 it means you will go 1 more tile to the south(down).
The third number is for the floor. If you add 1 it means you will go 1 floor up.

This button will give you a popup like below, here you can adjust the time you want to wait.The time is in milliseconds this mean 1000 is 1 second. Wait can be useful if you talk and don't want to spam everything almost at once. Wait is also useful if your previous waypoint was a teleport tile.

This button will give you a popup like below, here you can adjust the name of the label.A label can be useful in several ways, the main reason of using it is to make clear what is going on at that point of the waypoints.
For example a label to show that you are in depot is a good beginning of a waypointlist. Besides of using it as a clarification, it can also be used to let the cavebot return to that point. This can be done with the use of a function shown below.

waypoints.gotoLabel("atHuntspot")

To learn more about functions read it here.

This button will give you a popup like below, here you can adjust the location (current location is shown).
This is the same popup as the goto button gives, the difference is that the bot will use that location.
It's common used to get up ladders, it is advised to make a goto waypoint before it.

This button will give you a popup like below, here you can adjust the message.The text will be said in the default channel. It is advised to not use this in your (full AFK) cavebotting sessions. 

This button will give you a popup like below, here you can adjust the character/creature you want to follow.This can be really useful if you need to talk to an NPC that moves around, in this way you will always be close enough to have a conversation with the NPC.

This button will give you a popup like below, here you can adjust the location and item to use.

The first number will be the itemid of the item you want to use, this could be for example a rope. The other 3 numbers are the numbers for the location where you want to use the item. To find out what ID your item has, you can do Ctrl click on the item. Which will show the options of that item and at the bottom it states the ID. For the rope example it is 3003. 

This button will give you the same popup as say, here you can adjust the message.
The text will be said in the the NPC channel. Which makes this very useful for your (full AFK) cavebotting sessions. You could use this to for example deposit the gold you gathered from your hunt. The outcome would look like this:

label:depositGold
npc:Hi
wait:500
npc:deposit all
wait:500
npc:yes
wait:500
npc:bye

This button will give you a popup like below, here you can enter your function:This is probably the most difficult part of the cavebot, here you can address functions to execute them. It is important to follow what is said in the standard example. So the function will only be executed if the previous goto was successful or the function is after a label. It also has to return true otherwise it will be in an eternal loop. Here you could for example buy potions, this could be done as shown below:

function(waypoints)
  -- your lua code, function is executed if previous goto was successful or is just after label  
  schedule(100, function() NPC.say("hi") end)
  schedule(700, function() NPC.say("trade") end) 
  schedule(1400, function() NPC.buy(266, 100) end) 
  NPC.closeTrade()

  -- must return true to execute next command, otherwise will run in loop till correct return
  return true
end

To learn more about functions read it here.