I'm not sure if this will helps, but anyways, here's we go. I'll keep this scripting-related.
When I started learning about programming, I used to think I would have to do everything by myself. Everything from scratch. That is NOT the case in programming, especially java. In java, there are always classes already created by other people that you can import and use whatever "tools" there is in that class. When I started programming I always thought of myself making scripts for runescape, but I thought it was something hard to do, because I kept thinking about "How am I going to make the character walk?" , "How am I going to make the character attack, eat, teleport, etc". That's when I found out about the OsBot API. The definition of API is the following:
The API will provide you with tools (methods, actions) that you can use to make your scripts.
With the API, I found the solution for my questions mentioned above.
How to walk? - Use the WebWalking class from the API
walking.webWalk(Location);
How to check if my inventory is full? - Use the inventory class from the API
getInventory().isFull();
How do I check my magic level?
getSkills().getDynamic(Skill.MAGIC);
And so on...
What I'm trying to say is, someone else have made the tools for you, you don't have to worry about making them. Now you have to think about how your script is going to run. What should it do? What should it check? This is where logic comes in. This is where pseudo-code is useful.
For a simple tree cutting script, this is what I think of my character to do:
If I have the wc lvl, go to next if. Else, log out.
If I am wielding the axe, go to the next if. Else, wield the axe.
If my inventory is not full, cut the trees. Else, clear my inventory.
Turning that into pseudo-code (basically the same thing but with the correct structure):
Check if I have the woodcutting level needed
Check if I am wielding the axe
Check if my inventory is not full
Cut the trees
else
Clear inventory (bank or drop items)
else
Wield the axe
else
Log out because have no woodcutting level
And turning that into actual java code
private void woodcuttingTest() throws InterruptedException{
if(getSkills().getDynamic(Skill.WOODCUTTING) > 1) {
if (equipment.isWearingItem(EquipmentSlot.WEAPON, "Bronze Axe")){
if (!getInventory().isFull()){
Entity tree = getObjects().closest("Tree");
tree.interact("Chop down");
}
else{
getInventory().dropAll();
}
}
else{
inventory.getItem("Bronze Axe").interact("Wield");
}
}
else{
logoutTab.logOut();
}
}
I used to be very confused when I first started, so hopefully this clear your mind out.
This post is more related to scripting, if you want to learn more about java I suggest reading books, looking up JAVA guides on youtube to learn how the language works.
This tutorial will help you A LOT in your scripting questions: