Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Deluxes

Script Debugging Tutorial

Recommended Posts

This tutorial will teach you how to use an IDEs debugging to utilize break points to debug your TRiBot scripts. This tutorial will only show how to do it with Intellij, but that same thing should apply to other IDEs.

Setting up Intellij to run TRiBot

1. We must set up the project dependencies. You can get here by using Ctrl+Alt+Shift+S or going to File -> Project Structure

ncUwxBM.png

 

Once you are here, click on Modules and select the dependencies tab.

UeHQqBY.png

 

Debugging Tribot requires you add the following files to your dependencies.

To add a dependency, click on the green + next to Scope and click JARs or directories.

tools.jar You can find this in your jdk directory.  Example: C:\Program Files (x86)\Java\jdk1.8.0_101\lib

substance.jar You can find this in your %AppData% Tribot location. Example: C:\Users\Your User\AppData\Romaing\.tribot\dependancies

trident.jar You can find this in your %AppData% Tribot location. Example: C:\Users\Your User\AppData\Romaing\.tribot\dependancies

bin You can find this in your %AppData% Tribot location. Example: C:\Users\Your User\AppData\Romaing\.tribot\bin

 

2. We must setup a new Run/Debug Configuration. You can get here by going to Run -> Edit configurations

KhFejKD.png

 

Once you are here, create a new Application configuration by clicking on the green + and clicking Application.

iFaOhvh.png

 

The new configuration will be created and we must edit the settings now. I named my configuration Tribot.

Main class: org.tribot.TRiBot

VM options: -Xmx386m -Xss2m -Dsun.java2d.noddraw=true -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xbootclasspath/p:"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\xboot860.jar" -classpath "C:\Program Files (x86)\Java\jdk1.8.0_101\lib\tools.jar";"C:\Users\Spencer\AppData\Roaming\.tribot\bin";"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\substance.jar";"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\trident.jar";"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\TRiBot.jar";

Make sure to switch out the directories to what they are on your computer.

Program arguments: TRIBOTSESSIONID MEM384 OLDSCHOOL

Replace TRIBOTSESSIONID with your session id. You can find this in %AppData%\.tribot\settings\startup.ini

PLEASE NOTE: if your session id does not start with SID, add it to it.

Example: ccaa-das9fg87ad9fg7a98df7ga98df7g2aead32kjhhj13k

You should place: SIDccaa-das9fg87ad9fg7a98df7ga98df7g2aead32kjhhj13k

Hit apply and you are ready to go.

 

Using breakpoints to debug your script.

Breakpoints are extremely useful for debugging your program. They allow you to stop the program during runtime and see what is happening.

Lets use this simple script as an example.

4LovBOr.png

I'm having an issue. Even though I'm near the Oak Trees my script is not clicking the Cut option. We can debug this by adding a break point and stepping through the script.

To add a breakpoint, you click on the empty area next to the line numbers which will place a red circle. This red circle is a break point. While debugging, any time your script hits said circle, the script will stop and you will be able to interact with it.

VR2HGd2.png

 

Now that I have a break point setup, its time to debug it. We can launch the TRiBot client by going to the Run menu and clicking Run -> Debug 'Tribot'. If this option is not available, you can click Run -> Debug... and select the correct configuration. Once your client has loaded, you can run the script you are debugging.

When a breakpoint is triggered, your script will pause and options will be available within the IDE.

Ffdqdp9.png

A blue line represents the current line you are debugging. You will notice that your client has frozen while you are interacting with a break point. To prevent this, right click on your break point and change Suspend All to Suspend Thread.

3veDyEy.png

Now when you encounter a break point, your client will no longer freeze but you can debug the script. Now about the real problem. Why isn't my script clicking Cut on the oak tree?!?!

Well we have a few options here. We can use some nice features down at the bottom in the debugger.

wRnYLrY.png

QAY9Iug.png will rerun the program. This will close your current client and open a new one.

00D6OC6.png will continue the program until it encounters the next break point.

mOWguAt.png will stop the program, ending your tribot client.

fSxMiMi.png will "step over". This will run the line of code and go to the next one. It will not go into any method calls.

74USdOm.png will "step into". This will run run the line of code, stepping into any method calls that are made.

The reason debugging is extremely useful is you can see in real time what each line of code is doing. In this program, we can "step over" all of our lines, and see the line 17 will gathers all Oak trees in our area. If there is more than 0 Oak trees in the array, it will attempt to click the Cut option on the first one. By repeatedly clicking step over, we can see what happens.

Now why can't it cut the tree??

Lets "step over" so we are on the trees[0].click line.

x68rbLQ.png

If we right click we can see an option that is Evaluate Expression. Click it, or press Alt-F8.

rUfFIB1.png

 

This will bring up a new window that looks like this.

cSsgbl5.png

 

This allows us to run code that doesn't even exist in the script!!!

Lets try running

trees[0]

and pressing Evaluate.

YXcLiEW.png

We will see some stuff that doesn't really make sense, but at least we know that there is a tree that we can click on.

By typing a

.

on that line, intellisense will prompt us with valid things we can type. Lets look into the objects definition. We can do this by typing

trees[0].getDefinition()

Well, that brings up some more values that don't really make sense for us. By looking at the Tribot API or even typing another . to see what are valid things we can type we can see that 

trees[0].getDefinition().getActions()

is valid. Lets try that.

wfZGmfN.png

Hmm, it tells us that Chop down and hidden are valid options for interacting with this tree. I think I found my issue. Cut is not valid and Chop down is.

lcJ417h.png

By evaluating this, the result is true, and in the TRiBot client, the bot successfully clicked on the tree!!

 

This is just a small introduction on what you can do with debugging. For more information on what you can do while debugging, consider consulting google.com.

  • Like 10

Share this post


Link to post
Share on other sites

This is what I ended up for using for Debian 8.

 

-Xmx1048m
-Xss2m
-Dsun.java2d.noddraw=true
-XX:CompileThreshold=1500
-Xincgc
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
-Xbootclasspath/p:"/home/<user>/.tribot/dependancies/xboot860.jar"
-classpath
"/usr/lib/jvm/java-8-oracle/lib/tools.jar:/home/<user>/.tribot/bin:/home/<user>/.tribot/dependancies/substance.jar:/home/<user>/.tribot/dependancies/trident.jar:/tmp/tribot_6231ebe5d6.jar

Share this post


Link to post
Share on other sites
Quote

VM options: -Xmx386m -Xss2m -Dsun.java2d.noddraw=true -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xbootclasspath/p:"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\xboot860.jar" -classpath "C:\Program Files (x86)\Java\jdk1.8.0_101\lib\tools.jar";"C:\Users\Spencer\AppData\Roaming\.tribot\bin";"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\substance.jar";"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\trident.jar";"C:\Users\Spencer\AppData\Roaming\.tribot\dependancies\TRiBot.jar";

Is it possible to load client with specified proxy from VM options?

Share this post


Link to post
Share on other sites
Posted (edited)

This is old, but for anyone having trouble with this, I needed to add Apache's commons-lang3 jar to the classpath, along with any external libraries you may have in VM options.  Otherwise, the 'Start script' button crashed.

 

There's probably a way in IntelliJ to set the configuration to use the same classpath as you have setup in the intellij project, but I haven't found it yet.

 

Thanks for the tutorial, haven't found anything else on debugging through IDE for tribot, and manually debugging makes me want to die.

Edited by Bottingman9000

Share this post


Link to post
Share on other sites
Posted (edited)

Anyone getting the error?

Could not find or load main class org.tribot.TRiBot

I referenced it in my configuration so i don't exactly know what i'm doing wrong?

image.thumb.png.c586cfa7f2e4c190f876d4807d884330.png

 

For anyone else, this is intellij derping out, just create new run configuration.

Edited by Zapcrack
Fixed issue

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.

Guest
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.

Sign in to follow this  

  • Similar Content

    • By idkfa
      Hello my knowledgeable friends,
      Ive botted about 3 accounts to max combat and ran small gold farms but lately I really interested in learning how to script myself so I can give back to the awesome community and start goldfarming on a professional level. That being said ive got some questions.Little background check, im a total noob when in comes to programming languages.
      - ive read that learning Java is a must. But what I don't understand is do I need to learn everything about java or just parts that are relevant to scripting for Tribot. Do I have to take a course or to do a deep dive like enlisting in an education  or is learning Java just for Tribot enough?
      - If a book is preferable, do you have any recognmendations?
      - after being proficiant in Java ive read I still need to learn how to script for Tribot specifically. Is this a long process?
      - I know this is a difficult question to answer but how long do you guys recon this process will take in hours learning Java and scripting for Tribot? Ive got about 2/3 hours to spare a day and about 5/7 on weekends
      - Also is there a discord with like minded people out there looking to learn java/tribot and also one for goldfarmer (not gonna ask for methods lol)
       
      Sorry for the long and nooby questions. Hope you guys can point me in the right direction. 
      Any constructive comments are greatly appriciated.
      Cheers,
      IDKFA
    • By Candle
      What's up guys! 
      I'm new to scripting and I want to be the best! But I need some advice and pointers. I understand the simple side of java, just really how to fit the API into it all. 
      Any links to some really good content and videos? The only videos I can really find that's solid content is from Nexus, but it's only 2 videos. 
      Anything is appreciated! I hope to soon bring everyone some crazy awesome scripts! 
    • By NeuroGenix
      Post rewritten after rewritting and updating the code multiple times.
      So I decided to give writing my own GE API a go and this is what I've come up with so far, using Exchange#offer(name, price, quantity, buy) will do the following:
      If the GE is closed, it will open it and continue making the offer. If the price is set to -1 then it will use the buttons to increase or decrease the price, depending on whether it is a buy or sell offer, until it is at a price that will buy/sell instantly. Otherwise it will use the custom input button to set the price. It will set the quantity using the 1/10/100/1000 buttons. I plan on updating this to randomise between using them and the custom input method shortly. Edit* I hadn't even remembered implementing this until I saw it do it whilst testing the method, and it was beautiful, but if it goes over the buy quantity accidently, in the example I saw it was clicking +100 and clicked it again too fast so instead of stopping before its target of 875 it got to 900, it will then use the custom amount interface to input 875, beautiful. It will prioritise buy offers over sell offers so that if there isn't an empty slot available, or any items to collect, then it will cancel a sell offer, collect it and continue now it has a free slot. If there isn't a free slot available and we are trying to sell something it will return true, this is so that in my scripts it will remove the item from a toSell HashMap and put it back into the bank to sell later because it has bought the items it needs to continue botting. If it is instead trying to buy something and there are no empty slots or sell offers to cancel then it will wait for something to buy and continue once it can collect something and therefore has an empty slot. Update* It will now search for the item 1-3 words at a time checking the first 9 results each time and will choose the item as soon as it is visible as a human would. I might update this so that it randomises more, sometimes entering the whole first word of an items name straight away, because I sometimes do that, most of the time though I enter as few characters as I need to, I think, thoughts? Let me know what you think, the code is probably disgusting to look at for some of you but for others just starting out like me it could be a valuable learning tool, for how not to code All feedback and constructive criticism appreciated.
      Exchange Class
      GEInterfaces Class
      GEConditions Class
      InfoHelper Class
      Thank you to everyone that has read this far, it is appreciated
      Rewritten, if you have read again, even more appreciation!
    • By zoxind
      I've written my first, I would say for now basic script for combat training. 
      One of the main reasons why I chose to use Tribot is because of abc2. But while reading the post on the tutorial on how to implement it in your own code (
      ) I didn't really understand the method(the way) on how to implement it in code. 
      Could anyone please send me a personal message with an explanation on how to implement it correctly, or write a reply here.
      It would be very nice, if you would include an actual code example of it, that would help me to understand it better.
      Thank you in advance.
    • By Frosty XVII
      Hello everyone,
           I used to bot a lot with Tribot. I've been gone for what feels like well over a year. I just had some questions for my fellow botters and scripters.
       
      What is the botting scene like right now? Last time I left people were just botting throw-aways and still making cash.
      Any new updates to osrs? How has OSRS changed in the past year? I plan on looking over the update logs, but anything cool happen?
      In terms of Tribot, have the devs introduced any cool new technologies? Like a more efficient LG or anything?
       
      Frosty
    • By JordiLaFjord
      Hey.
      Just trying to right click make all on the gold bracelet interface. Most recent thing i've trid is getting the RSInterfaceChild braceInterface = Interfaces.get(446,47); then calling it as braceInterface.click("Make-All");
      I've tried a few other things from the forum that I can't thing of atm, so any help would be appreciated.
    • By goxdom
      How can I determine if the character is stunned? Any methods out there for this? I'm currently checking something like "currentHP < previousHP" after a certain action but it is not ideal for every occasion.
    • By Forsteen
      Hey,
       
      I'm making my own script and I want to check if there are any players within a certain range of me. I'm hoping this can be done using the Players part of api2007, using something like getAll() with a filter. The problem is, I don't know anything about filters, and I can't find any documentation of it except a post here on tribot explaining the concept, not how to actually use them. Could anyone either explain how to use filters or link me something which I can learn from? That would truly be great.
      EDIT - I just found the page specific to Filters.Players. This seems good enough for me to figure out.
      Thanks!
    • By Trauken
      Hi,
       
      I have some java experience and figured I wanted to have a go at  creating my own script, so I looked at the "Scripting Tutorial" by Trilez, and everything makes sense to me, but as I try to import the org.tribot.script.Script i get an error... I've read through the beginning of the tutorial but I really can't find what I'm doing wrong, is it possible that the tutorial is outdated and that I should import something else?
      Thanks!
    • By Xenare
      I started scripting yesterday and wanted to share a basic snippet from the Movement class I have been working on, hopefully it could be useful to anybody starting out and it gives me a chance to get any criticism and possible improvements.
      //Walk to random location near destination by radius static public boolean generateWalkPathArea(Positionable end, boolean object_adjacent, int radius) { DPathNavigator nav = new DPathNavigator(); //Return walkable tiles in given area RSTile[] walkableTiles = getWalkableTiles(new RSArea(end, radius)); if (walkableTiles.length == 0 || walkableTiles == null) return false; //Generate path to one of the walkable tiles RSTile[] path = nav.findPath(walkableTiles[General.random(0, walkableTiles.length - 1)]); //Checks path exists if(isPathWalkable(path)) { //Send path to the Painter Paint.path = path; //Traverse path until within proximity or timeout if (nav.traverse(path[path.length - 1])) return Timing.waitCondition(new Condition() { @Override public boolean active() { General.sleep(General.random(25, 50)); return proximityOfDestination(path[0]) < 4; } }, General.randomLong(2500, 3000)); } return false; } //Return distance between player and destination static public int proximityOfDestination(Positionable destination) { return Player.getPosition().distanceTo(destination); } //Return walkable tiles in given area static public RSTile[] getWalkableTiles(RSArea area) { ArrayList<RSTile> walkableTiles = new ArrayList<RSTile>(); //If tile is walkable add to ArrayList for (RSTile tile : area.getAllTiles()) { if (PathFinding.isTileWalkable(tile)) walkableTiles.add(tile); } return walkableTiles.toArray(new RSTile[walkableTiles.size()]); } I have noticed some odd behaviour with DPathNavigator and do not wish delegate short distance movement to Dax's WebWalker which would introduce another unnecessaryfail point to any scripts, because of this I imagine I will be writing my own short distance movement class in the future and some improvements on the above code would be awesome.
      Cheers and hope this is useful to someone.
  • Our picks

    • Today marks a big day for TRiBot! To make it easier for users to use TRiBot, we've created installers available for every platform! These installers are all bundled with the latest version of OpenJDK 1.8 (Java 😎, which is LG compatible.

      Using TRiBot is now easy. Simply download the installer for your platform, install TRiBot, and run it. The TRiBot Loader will correctly identify the bundled JDK so there's no need to change the Java selection.

      Windows

      EXE installer: TRiBot-windows-x64-4.0.3.exe


      MSI installer: TRiBot-windows-x64-4.0.3.msi


      Portable version: TRiBot-windows-x64-4.0.3.zip


      Mac OS

      Installer: TRiBot-macos-4.0.3.dmg


      Portable version: TRiBot-macos-4.0.3.tgz


      Unix/Linux

      Installer: TRiBot-unix-4.0.3.sh


      RPM installer (CentOS/Fedora): TRiBot-linux-4.0.3.rpm


      DEB installer (Debian): TRiBot-linux-4.0.3.deb


      Portable version: TRiBot-unix-4.0.3.tar.gz


      Platform Independent

      JAR file: tribot-loader-4.0.3.jar


      Note that this jar file does not include the bundled JDK.



      Windows and Mac OS users may notice a warning message stating that the installer/application is un-recognized or un-trusted. Please ignore this message and proceed with running the installer/application. We need to acquire a code signing certificate so that we can sign the installers letting the operating system know that these files can be trusted. It will take a week or more to acquire one, so please hold tight.

      Other notable changes to the TRiBot Loader:

      Support getting the version from OpenJDK distributions


      Add check for bundled JDK


      Copy OpenJDK tools.jar to the bundled JDK if not present


      Set the current java as the first available list entry


      Ignore Java versions which are symbolic links


      Make the bundled JDK the preferred Java version


      Update icon images


      Reduce the number of HTTP calls
        • Like
      • 11 replies
    • TRiBot is looking to improve a lot of its customer relationship management, customer on boarding process, customer experience, design elements, community engagement and pretty much everything else you can imagine when it comes to marketing.

      Our goal: To ensure that the marketing done TRULY reflects the experience and does not shine an inaccurate light on what TRiBot is lacking in.

      So I ask, what do you love about TRiBot and what do you hate about TRiBot? What does O S Bot, Rune M8, PowR Bot and Dre amBot do better? (yes I purposely didn't spell it right 😂).

      Love, 

      RileyZ
        • Like
      • 7 replies
    • Hello TRiBot,

      Today we have a significant release that has been in the works for the last month addressing several key issues, features and bugs in the backlog.

      With these changes, we are also including a new TRiBot Loader which will allow you to select any version that is released. This adds the flexibility of allowing you to revert to a previous version should an issue arise, run development only builds, view an accurate change log between versions etc. we are very proud to offer this feature and think it will add a lot more functionality down the road as we continue to release new versions.

      These changes include 80+ commits by our development team, a list of them is summarized below and also available for your viewing pleasure in the new TRiBot Loader.

      In addition, we have taken additional steps to improve as a development team by adding continuous integration and deployment into our workflow to assist in delivering timely releases such as bug fixes as well as new features on a weekly basis depending on our development cycle.
        • Thanks
        • Like
      • 39 replies
    • Over the last three weeks, I've been working on upgrading our server infrastructure. It's finally ready and is now live!

      Why?

      Increased reliability - less server errors


      Increased availability - less downtime


      Increased security - keeping us and you secure


      Increased capacity - ability to serve you better


      Increased speed - less waiting for things to load


      Faster development - server and service updates will come faster


      What are the changes?

      Move from a single AWS EC2 instance to AWS ECS (Elastic Container Service)


      Distributed computing


      Load balancing


      Git management of server files and filesystem


      Redis caching


      How?

      AWS ECS (with 10 EC2 instances)


      AWS ElastiCache (Redis)


      AWS Load Balancing


      AWS EFS (Elastic file system)


      Please bare with us as I continue to tune the server for maximum performance. Slow loading speeds may occur temporarily. I thank everyone for their patience.

      Please post on this thread if you experience any issues other than slow loading times.
        • Like
      • 51 replies
    • This update features:

      Fixed broken hooks from today's update


      Fix wilderness level with RuneLite (Thanks @Todd)


      Add support for Kotlin .class files in scripts (Thanks @wastedbro)


      Overhaul Inventory API (Thanks @wastedbro)


      Add List support for common methods


      Change method grouping to make more sense (by functionality)


      Refactor methods to utilize Java 8 streams instead of cumbersome loops




      Recognize chatbox minimization (Thanks @JoeDezzy1)


      Fix Screen#isInViewport when NPC chat is open (Thanks @JoeDezzy1)


      Fix login bot bugs (Thanks @erickho123)


      Fix hint arrow return values (Thanks @Encoded)


      Fix depositAllExcept functionality (Thanks @wastedbro)


      Change containing box interface bound and adjust for Y values (Thanks @erickho123)
        • Like
      • 151 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...