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

An Introduction to Script Development for TRiBot

Recommended Posts


This tutorial uses Windows 10 and IntelliJ IDEA.


  • Java knowledge equivalent to someone who has passed a college level introductory Java course with complete understanding of the course.
  • Java Development Kit installed.
  • VIP or VIP-Extended on TRiBot (required to run local scripts).


  • Experience with a Java IDE.
  • Experience programming outside of a classroom setting.

Learning Resources

TRiBot Java Documentation



  • Preface
  • Getting Started
    • IntelliJ IDEA Setup
    • Creating Your First Script
    • Uploading to the TRiBot Script Repository
  • Script Design
    • Task
    • Decision Tree
    • Variables and Constants
  • Development Tools
  • Essential Classes and Methods

Getting Started

IntelliJ Idea Setup

Download and install IntelliJ IDEA community edition from JetBrains.com.

If you have never ran the TRiBot client before, do so now and let it load Old School RuneScape all the way up to the login screen. After doing so, I would recommend restarting the TRiBot client, although this is not required.

Create and Setup the IntelliJ Project

On the IntelliJ welcome screen, select Create New Project
If you already have a project open, then select File -> New -> Project…
Select the Java verison or if none are available, press New... and locate the directory in which Java is installed.

Project SDK

Click Next skipping the project template option and you then should come to a window that allows you to set the project name and location.
Set those to whatever you want and then click Finish

Adding TRiBot.jar to Project Libraries

Select File -> Project Structure and in the window that opens select Libraries
Click the green + and select Java.

Add Java Library

You will now need to locate TRiBot’s dependencies folder.
On a standard windows installation, this folder will be located at C:\Users\REPLACE_WITH_YOUR_WINDOWS_USER\AppData\Roaming\.tribot\dependancies Yes, dependancies is mispelled.

TRiBot.jar Dependency

Once you have navigated to the dependancies folder inside IntelliJ, select TRiBot.jar and press OK

Note: AppData is a hidden folder and will not display in IntelliJ’s file explorer. You will need to type in the path at the top of the window for it to show. Do not press enter after typing the path, the file explorer will automatically refresh as you type.

On the next window you should only have one module. Make sure the module is selected and press OK

Configuring Output Path

If you have closed the Project Structure window, reopen it by selecting File -> Project Structure
Navigate to the Modules tab and make sure your only module is selected.
Select the Paths tab and then select the radio button Use module compile output path
Change both the Output path and Test output path to C:\Users\REPLACE_WITH_YOUR_WINDOWS_USER\AppData\Roaming\.tribot\bin\
Click Apply and then OK

Creating Your First Script

All of your classes will need to be in the package scripts
In your src folder, create the package scripts

scripts package

Inside the scripts package, create a new Java Class named HelloWorld


Extend Script and implement the method run
Note: Make sure you import org.tribot.script.Script and not sun.font.Script

Add a ScriptManifest which will provide the TRiBot client information about your script so it can be properly categorized in the script selector.
@ScriptManifest(authors = "Encoded", name = "Hello World", category = "Script Tutorial")

Add println("Hello World"); inside the run method and the basic script skeleton is complete.
println prints to the Client Debug at the bottom of the TRiBot client. This method is inhereted from Script, but an equivalent method can be found in the General class.

Build your project (Build -> Build Project) and then press Start Script in the TRiBot client.
If your script does not show up in the script selector, then you have done something incorrect or you do not have VIP.


package scripts;

import org.tribot.script.Script;
import org.tribot.script.ScriptManifest;

@ScriptManifest(authors = "Encoded", name = "Hello World", category = "Script Tutorial")
public class HelloWorld extends Script {

    public void run() {
        println("Hello World");


Creating Additional Modules

When developing a script that is more than one class file, creating a specific module for that script is highly recommended.
For each additional module, you will need to change the output path like you did above and add the TRiBot.jar library as a module dependency.

Removing RS3 Auto Imports

IntelliJ IDEA will auto import for you. This can lead to unwanted behavior such as importing RS3 classes when you wanted OSRS.
To fix this, go to File -> Settings... -> Editor -> General -> Auto Import
In the Exclude from Import and Completion table, add obforg.tribot.api.rs3, and sun.font.Script

Auto Import

Uploading to the TRiBot Script Repository

To upload to the TRiBot Script Repository, you will need to create a .zip file with your script’s java source files.
The zip file acts as your scripts package.
You will need to keep the same package structure you’re using in IntelliJ. If you have the package scripts.agility you will need to have the agility folder inside in the zip.
As an example using HelloWorld.java from above, create a zip file named HelloWorld.zip and place HelloWorld.javainside.
HelloWorld.zip is now ready to be uploaded to the repository, but please do not upload it in attempt to keep the repository clean of unwanted scripts.

Note: Do not place your compiled class files inside the zip file, only java source files.

Script Design

Two of the most common script design patterns will be covered:

  • Task
  • Decision Tree


The task design pattern consists of a collection of tasks that have a validation and execution method. 
The collection is then iterated over and if a task’s validation method returns true, then the task is executed.
Tasks are typically stored in a Set or a List.
Here is a short tutorial for the Task Framework.

Decision Tree

The decision tree design pattern consists of a manually created decision tree that is traversed using a modified preorder depth-first search until a valid runnable node is found.
Here is a tutorial for the Decision Tree Framework.

Variables and Constants


To manage variables, I use a Vars class. The Vars class will be a singleton. A singleton is not needed, however, when managing a shared resource such as variables, a singleton is preferred. To access a variable, you will call Vars.get().variableName
Note: There might be more proper ways to manage variables, but this has proved to be the most effective for me.

public class Vars {

    private static final Vars instance = new Vars();

    public int variableName;

    public static Vars get() {
        return instance;

    private Vars() {




To store constants, I use a final Constants class. This allows you to static import constants so there is no need to have to reference the class and then the constant.
Note: The Constants class is not a substitution for enums. You should be using enums wherever possible.

public final class Constants {

    public static final int EXAMPLE_CONSTANT = 1;

    private Constants() {



Development Tools

  • TRiBot Debug Options
    • All options listed under the Debug tab in the TRiBot client.
  • Interface Explorer
    • At the top of the TRiBot client, navigate to Tools -> Interface Explorer
  • LAN ScriptTools
    • Contains various tools to aid in script development.
  • Area Creator and VarBit Explorer
    • These tools will either need to be developed yourself or can potentially be found on the TRiBot forums.
  • Java VisualVM
    • Used to monitor CPU and memory usage. Can be found within the JDK installation directory.

Essential Classes and Methods

  • RSArea
    • Should always be used to check if a location is within a area.
  • Clicking
    • Should be used for all clicking that involves an entity to stay consistent.
  • Timing.waitCondition(Condition c, long timeout)
    • Should always be used where applicable.
Edited by Encoded
  • Like 4
  • Thanks 3

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

    • This release will:

      Fix prayers and world hopper API (Thanks @JoeDezzy1 and @erickho123)

      Improve banking API (Thanks @Encoded)

      Adds methods for returning and using Java Lists, rather than arrays

      Slightly randomizes some hardcoded behaviour

      Removes sleeps from waitConditions; the efficiency saving potential is negligible in these use-cases, therefore cleaner code is preferable

      Other back-end improvements

      Note: If you are using LG, please restart both the RS client and TRiBot.
        • Sad
        • Haha
        • Thanks
        • Like
      • 85 replies
    • This release will:

      Add new internal framework for capturing exceptions

      Fix issue with not selecting the last column in world hopper (Thanks @Todd)

      Add a message about pin usage in Banking#openBank (Thanks @Todd)

      Disable the firewall by default (Thanks @Todd)

      Fix handling of the welcome screen after login (Thanks @Encoded)

      Fix wrong amount bank withdrawal (Thanks @Encoded)

      Fix Screen#isInViewport

      Fix Game#isInViewport (Thanks @Encoded)

      Call onBreakEnd for ListenerManager Breaking Listeners (Thanks @Encoded)

      Fix Prayer#getPrayerPoints NumberFormatException (Thanks @JoeDezzy1)

      Note: If you are using LG, please restart both the RS client and TRiBot.
        • Thanks
        • Like
      • 28 replies
    • This release will:

      Fix LG for both OSBuddy and RuneLite

      Fix issue where the resizable client isn't able to be made smaller (Thanks @JoeDezzy1)

      Fix detection of the logout game tab when resizable mode and side panels are enabled (Thanks @JoeDezzy1)

      Add initial support for Sentry to allow us to identify and easily debug exceptions happening with all TRiBot users

      Add methods to determine if the bank is actually loaded, and not just the overarching interface (Thanks @wastedbro)

      Upcoming updates:

      Improved CLI support

      Full Sentry support

      Much more
        • Like
      • 64 replies
    • This release will:

      Fix NPE in Camera API (Thanks @wastedbro)

      Update deposit box interface ids (Thanks @Encoded)

      Add various bank methods (Thanks @wastedbro)




      Fix resizeable minimap bug (Thanks @wastedbro)

      Remove Java 8 requirement

      Please note: TRiBot is not yet fully compatible with Java 10+

      Fix the break handler issues by ensuring the break handler thread never gets paused

      Fix broken settings hooks

      Upcoming updates:

      Improved CLI support

      Much more

      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 68 replies
    • This release will:

      Add support for using custom F key bindings to switch between game tabs (Thanks @erickho123)

      Fix tab opening for "Skills" and "Kourend Tasks" (Thanks @erickho123)

      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 34 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...