Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Buy OSRS Gold

Sell OSRS Gold

Scripting Guide For completely noob with 0 java knowledge

Recommended Posts

This Tut is going be for ppl how want to start scripting for tribot and dont know where to start and how to start i will be guiding u through the process here and i will make 2 basic scripts a WOODCUTTING  and MINNING Scripts 

**I am not making a video and guiding through this post cause of my accent as Arabic is my first language ..

** Please avoid copy and past to learn somthing ...

First the requirement 1- You will need IDEA I am going use Intellij  

                                       2- You will need to setup tribot with it 

                                        3- You dont need basic java programming to watch this and u will understand it for sure 

so lets Dont make it much longer and lets start :D 

First of all we going use Node Framework thanks to @Worthy


so lets just say what is Node framework do:

Basically a Node consists of 2 major parts 1- A validation 

                                                                              2- An Execute 

Just Ignore every thing in that photo it just shows you what dose Node look like  Node.thumb.PNG.b4f9d536d72b0cdeacd932e659f32727.PNG


So we have 2 things to go with 1- Validation that what we need the bot to check if it is happening it call the Execute method in that node 

so lets say we need the bot to cut the tree if it is not cutting so we write in the Validation method if not cutting codes and in the execute method of that node cutting tree node 

Now we done with our Framework so lets talk about making our first script^_^ 

The WoodCutting Script:

As i said before u need to have IDE and compiled it with tribot so u should get a screen like this.



If u have screen like this continue reading if not please figure it first and then continue or comment if u have a problem 


Now lets make out Script structure we Right click on our scripts and select new then select Package and name it what u wan your script to be we will name it WoodCutting after that we will find a new folder was created so now we need to add our main class << it is like our script soul >> 

we right click on our script package which we named <WoodCutting> and the choose new then choose Java Class and name it as u like but i like to name it as the package name so i am naming it <WoodCutting> Now u should look like this MainClass.thumb.PNG.5a846423a103e934e19b4ae67de32f02.PNG

if that what u have then u can continue else ask for the problem 

Now we going add our script name and the maker and version and so on this is called script manifestations how we can do this u just type this word in the line before Public class is


 then when u do that there is going be an error so u just use a short cut on Intellij and hit Alt+Enter it will gives u a suggestion on how to over come the error 

then hit enter to choose the first suggestion that should make it like this Manifestation.thumb.PNG.1dc1c636fa7577e9c0b6b698811ec089.PNG

if u cant use the shortcut just write the like as in the picture. 

now we need to author and category and script name so all of those are name we use Strings for that String is worlds we use in English so we use it btween those  " "   So at the author we write "GeniuSKilelr" Category "WoodCutting" Name "GeniusCutter" or change that names as u wan ^_^


Now we done with naming now we need to Implements our tribot main method >> Script 

So after the public class Woodcutting we a extends Script 

when u write Script u will find tons of scripts make sure to choose org.tribot.script one 

then u will find there is and error again so we use the same shortcut as before alt+enter then it will says that there is a method that isnt implemented so hit enter to implement it that would be the run method so u should be like this RunMethod.thumb.PNG.b663250d0ef75aa093e2890ed724d1ba.PNG

Again if u have it like this continue if not ask for help 

Now we almost done with our main method i said we going work with node framework before so lets implement it on your script 


Now we will create a package for our custom API , and a package to carry our Nodes that is more organized way to write a script 

as said before we will right click on the WoodCutting package we made and click new package and call it API .

once again create new package and call it Nodes to carry our nodes as i said before 

we should end up like this 


so now lets make our Node Framework 

Right click our API package and click new Java Class and name it Node

it will be like this Node.thumb.PNG.d27fb32e29bde2007a89fad2ccfe0af6.PNG

now we need to make it abstract so add abstract between public and class 

then write that code Between {  } 

public abstract boolean validate();

public abstract void execute();


Now we done with our Node class lets implement it in the main class 

write this code just before the run method we implemented before 


public static ArrayList<Node> Nodes = new ArrayList<>();

Again if u had any errors use the shortcut and if u faced any thing that u cant handle ask here for help i will answer assap 

now we implemented our Node framework to the main class now we need to implements the Nodes we will make into our run method so we go to the run method and Write this code in 


loop(40, 50); // the time it take to loop the nodes 

now we will find an error again so we use the shortcut to implement the missing method which is the loop 

when we use the short cut this method will be implemented 

private void loop(int i, int i1) {

at this method we need to make it loop the nodes we have so we add this code 

    for (final Node node : Nodes) {
        if (node.validate()) {
            sleep(General.random(50, 60));    //time in between executing nodes

so at the end u should be like this 


Now Remember all we have done now that is all u going do for almost every script u going write in Node Framework 

Now we done with structure lets go in coding the WoodCutting Script now ^_^ 


Now we writing a simple wood cutting script so we will need 2 thing 2 Nodes i mean 

1- Cutting Node 

2- Dropping Node 


Easiest thing first so lets do the Drop node 

so we go to our package called Nodes then right click and make 2 Java Class u should know how to do that by now

the first one lets call Drop and the second one lets call Cut 

now lets open the Drop node and make an extend Node as we made extend script in our main class 

so u should be like this Drop.thumb.PNG.10f8433f575a6687e3580da3b3df26ec.PNG


as i said before now we have a validation and execute 

*** return false mean that this node will never be executed 

so we need it to drop all items in inv if the inv is full so we change the false to check if the inv is full 

now we write instead of false >>>  Inventory and we will get a suggestion we must choose the one of tribot  

so now we called our Inventory now lets check if it is full so we continue writing so if we add . after Inventory we going find tons of actions we choose the one we are looking for then hit enter the one is is full so now we should be like this InvFull.thumb.PNG.dd6b374a963fb227a0f6fcc16e26727b.PNG


that mean that the bot will keep checking till the Inv is full then it will validate this node and execute what is in this node 

we what we need it to do if the inv is full we need it to drop all inv so we write in execute the code of dropping so we write Inventory.drop();

now we need to get the id or the item to drop  we can do that by having the item in inv then click the debug in tribot then cloose Inventory it will shows all the ids on the inventory so we get the ide and write it between () of the drop  2511 is the id for the logs so now it will drop all the logs so u should be like that DropAlmostDone.thumb.PNG.6319d5928a910c533287d78359dedb95.PNG

But there is 3 thing that may happen that lead to the script breakdown while inv is full 

1- if the inv isnt open so the script will break 

2- when it is going to drop it is going to use right click then drop we dont wan this we wan it shift drop 

3--if the logs is null >>> we need to check for like every thing if  it is not null almost for every thing 

we can check for null by two ways by the length or by not = null 

so now we need to fix those three things 

1- we will make the bot to check if the Inv tab is open or not before dropping 

2- we will make it use shift dropping instead of noraml dropping 

3- we will check if the length is more than 0 before dropping 

so for the first one:

we first call the Inventory tab by writing GameTab.Tabs.Inventory that call the inventory tab

so now we know how to call tabs 

so we write

if (!GameTab.TABS.INVENTORY.isOpen()) {


that mean if Inv is open but we need it to check if it isnt open so we add ! this mark mean not we always add it at the first 


if (!GameTab.TABS.INVENTORY.isOpen()) {


now we checked if the Inv isnot open then we need it to open theInv 

so between { } we add the code to open the Inv we going call tabs first then call Inv like before but instead of choosing isOpen we going choose Open 

so it is like this 



now we need to give the bot some time to open the Inv so we add a sleep for the script we have two type of sleep static and dynamic we going for static for now so we add 


now we  fixed the first problem .

now we need it to use shift dropping the second problem 

first we call Inventory as before then we add . to see all options like before we will choose setDroppingMethod 

it will be like this 


so now between ( ) we add the dropping method we wan it to be 

so it should be like this 


now we done with the 2nd problem now lets go for the 3rd problem 

the null problem i said i am going to use length to check so we before wrote the dropping code like this 


so we add a length check first before adding this code so we check for hm of logs are there in inv so we add this code 

if (Inventory.getCount(2511)>0) {
    General.sleep(500, 900);

that is like what length checker but i didnt wan to go to arrays and other things at your first tut so lets keep is simple for now 

what that code do is it check for the number of logs if >0 it will start dropping them 

now we done with the dropping node so the final dropping node should be like this DropingNodefull.thumb.PNG.ed764946b74716202d4e4ffa2c81ca47.PNG


Now lets start the Cutting Node

lets open the Cutting Node and extend Node as we did for dropping node 

we need it to cut as if the inv isnt full so we change the false to 


notice that i add ! before Inventory is full  so it is not inv isnt full 

now lets go for execute 

we need to identify the objects we need to cut <trees>  and put them at a box together [ ] this called array just dont give about it 

so to put that in a box we write that code 

RSObject[] TREE = Objects.findNearest(10,"Tree");

now lets talk about that line 

first we make a box and called TREE >>>>> RSObject[] TREE

then we have put some Trees in the box but we specified the objects we putting there to be near us within 10 tiles and the object have the name "Tree"

as i said at the start names is wrote between " " 

now as we have made a big box that have some trees in  we need to make the bot cut it down as our Inv is not full 

so we going to call the first object < Tree> within the box by this code Tree[0] as the box counting start with 0 then we write . to get the options as we said before the choose Click as we wan it to click the Tree 

when we choose click it should be like this Cut.thumb.PNG.d73b59ea4b7e4dfdda4dd4b03448e8e5.PNG

now it will click the tree but at every time u are writing a script make sure to specify the action u wan it to do so we will change the code to be like this 

TREE[0].click("Chop down");

now i specified the action i wan it to do 

now if we start running the script it will work but there will be 2 problems 

1- it will keep clicking the tree without stopping  even if it is cutting it down we dont wan this we wan it to sleep till it stop cutting 

2- as for the Node i said we need to check for null 

so lets fix the 2 problems 

the first problem is going be fixed by adding a sleep as we did in Drop node and i said there is two type of sleep dynamic and static we used static 

now lets use the better one the dynamic one and lets make it only cut if the player is idling and not animating the idling animation is always -1 


    return false;
, random4500, 5500;

that is the code for dynamic so what that code mean is it will sleep for a random time from 4.5sec - 5.5 sec >>>General.random(4500, 5500)

unless the return give back true so we need change that false with what we need it to be >>> Player animation is -1 as the player is idling 

so our code should be like this 

Timing.waitCondition(() -> {
    return Player.getAnimation()==-1;
}, General.random(4500, 5500));

first we called our own player then we add . to see the action then we choosed the animation action then we add == that mean equal then we add -1 as it the idling animation 

so what that mean it mean that the player is going idle for 4.5 to 5.5 sec or if the animation is changed to -1 

so our full code shoule be like this 

RSObject[] TREE = Objects.findNearest(10,"Tree");

TREE[0].click("Chop down");

Timing.waitCondition(() -> {
    return Player.getAnimation()==-1;
}, General.random(4500, 5500));

that should fix the 1st problem 

lets go for the second problem to check null 

last time we check the length by the count cause we didnt make an array <big box > and now we did here so lets check by length 

so we write this 

if (TREE.length>0) {

    TREE[0].click("Chop down");

    Timing.waitCondition(() -> {
        return Player.getAnimation() == -1;
    }, General.random(4500, 5500));

we add if ( TREE.length >0)  that check if the big box contains at least 1 tree 

so we avoid a null exception error 

now what if the tree is away from us by like 5 tiles it will keep clicking it till it reach it and start animation so we dont wan this so we add 2 fail safes 1 at the waiting condition and the other with the length checker 

so it should be like this 

if (TREE.length>0 && Player.getAnimation()==-1) {

    TREE[0].click("Chop down");

    Timing.waitCondition(() -> {
        return Player.getAnimation() == -1 && !Player.isMoving();
    }, General.random(4500, 5500));

now we add a check that it will never click the tree while it is animating and it will click it once and wait if the tree is away from use cause we add that the player is not moving in the waiting condition too 


Now we done with our two nodes lets implement them in the run method 


so back to our main class to the run method we will find this code 


to add a new node in it u just need to add this 

Collections.addAll(Nodes,new Cut(), new Drop());

Source Code


At the end i hope i didnt forgot any thing ^_^ if u leaned any thing please leave a comment waiting the Scripters feedback

This is my first guide ever but will be making alot more soon as i have some free time now after university

next guide will be adding bankNode and Walking Node and alot more soon feel free to ask me any thing peace  

Edited by testing1
  • Like 4

Share this post

Link to post
Share on other sites

I've found original guide for it from Worthy and there are while(true) used inside of loop method, and in this case it works fine. Have you even tried to run your code from github? And ints from loop (20, 40), is later used by Worthy in method loop(int min,  int max) ....... sleep(General.random(min, max));. In your code they're just useless.

Share this post

Link to post
Share on other sites
On 1/13/2020 at 7:19 AM, Revenant said:

I've found original guide for it from Worthy and there are while(true) used inside of loop method, and in this case it works fine. Have you even tried to run your code from github? And ints from loop (20, 40), is later used by Worthy in method loop(int min,  int max) ....... sleep(General.random(min, max));. In your code they're just useless.

about the while i forgot to add and i didnt run the code and i dont get what are u  talking about the ints 20,40 if u read the comments there in the pic u will know what the use of that ints 

Edited by testing1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Our picks

    • Hello everyone,

      Last week we tried to roll out Auth0 Login, but we lost that battle. Now it's time to win the war!

      Important changes

      When logging into the client, you'll now have to enter your Auth0 account credentials instead of your forums credentials

      Note: 2FA is still handled through your forums account (for the time being)

      Changes for existing users

      You'll have to link your Auth0 account to your forums account here: https://tribot.org/forums/settings/login/?service=11

      Auth0 accounts have been created for most existing users. Please use your forums email address and password to login.

      Important notes

      Make sure to verify your email address upon creating a new Auth0 account

      When we mention your Auth0 account, we mean your account used for auth.tribot.org as displayed below
      • 43 replies
    • To better support the upcoming changes (TRiBot X, new repository), we're switching our login handler to Auth0. Instead of logging in with the standard form, you'll now be required to login through our Auth0 application.

      All existing accounts which have been used within approximately the past year have been imported into Auth0 using the same email and password combination which has been stored on the forums.

      What does this mean for users?

      Your account credentials are now even more securely stored

      You'll be able to login via Facebook, Google, and others in the future

      Is there anything users have to do differently now?

      Existing users: You'll have to login with the standard login, open your Account Settings, then link your Auth0 account

      New users: You'll be redirected to our Auth0 app (auth.tribot.org) where you'll be able to create an account

      Why was this change made?

      The new apps we are creating (such as the new repository) aren't able to use the forums to handle user logins

      To centralize all user accounts in one area

      To ensure that the client login doesn't go down when the forums are having problems

      To speed up our development

      Other considerations

      There's no documentation or official support for using Invision Community combined with Auth0, so there are still a few kinks we're working out

      We're in the works of creating an account management panel specifically for Auth0 accounts (ETA August)

      It's not possible to change email addresses for the time being (this will be resolved this August)

      Changing passwords is a weird process for the time being. To change your password, you'll have to use the "Don't remember your password" tool on the Auth0 login page
        • Haha
      • 10 replies
    • Over the past month, we've been working hard on TRiBot's new repository - a much needed update. This change has been deemed necessary for TRiBot X, and will allow us to really speed up development of all aspects of TRiBot.

      Today we are going to share what we've been working on!

      Now you must be wondering what kind of features the new repository will have.... well, you'll have to be patient for a little while longer. We're still figuring out various technical aspects so we can't provide answers to all possible questions. We're also focusing on development rather than writing about it so that everyone can get access to our latest developments at lightning speed. I will however answer a few users' questions.

      We're planning on a release of this early to mid August, giving users some goodies before TRiBot X's release.

      Thank you all for being patient. I hope everyone is excited as much as I am!
      • 17 replies
    • Over the past few months, I’ve been working diligently on a new project - TRiBot X. Everything has been written from the ground up, with all of the best practices of software engineering. Every aspect of TRiBot has been re-imagined to support three main goals: flexibility, useability, and reliability.
        • Like
      • 50 replies
    • Come give us feedback on the next version of TRiBot!
      • 86 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...