Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
Boolean

Boolean's full eclipse set-up tutorial (mac OS)

8 posts in this topic

boolean's ultimate eclipse set-up (mac OS)


 


Here's the way to set up your eclipse with the bot, both for mac as for windows.


 


Things you'll need in advance:


 


The eclipse IDE


 


http://www.eclipse.org/downloads/


 


The latest tribot jar file


 


https://tribot.org/download.php


 


The latest version of java JDK.


 


http://www.oracle.com/technetwork/java/javase/downloads/index.html


 


 


Mac OS:


 


Install eclipse. When you open it it asks you to give in where you want your workspace. Choose where-ever you want. (mine's in documents, it doesn't really matter).


 


Okay so now eclipse opens, and I believe there's some kind of tutorial, you want to skip that, and go straight to the workbench. It should look something like this:


epgc.png


 


of course you won't already have a tribot file. But we are going to add that now.


 


In the package section, right click with your mouse and select new -> java project


dmrb.png


 


Nam the project however you want, i'll name mine TribotScripting.


after that you want to uncheck 'use default location'. because if we would use the default location your scripts would be saved in your workspace, and not instantly in your bot folder, so if you'd do that you'd have to transfer your scripts from your workspace to the tribot file every time you compiled your script, which is a lot of unnecessary work. We want to set it to the location of the tribot folder. This folder gets constructed automatically when you launch the tribot.jar for the first time. 


But where can we find this folder? (You need to know where this folder is if you want to add scripts you haven't written yourself).


i45t.png


 


There are a few ways to get there on a mac computer.


By directories:


go to: User > library > application support > tribot.


Here's where we have the tribot file.


 


BE WARE:


Mac often sets the 'library' folder in your User folder to invisible. If you can't see your library folder, there are 2 things you can do.


 


method 1: Set the library folder to visible:


I'd suggest you go to this tutorial: 


http://www.wikihow.com/See-Hidden-Folders-on-Mac-OS-X-and-Other-Recent-Models


 


method 2: Open the folder trough terminal


This is fairly easy, just open your terminal and write down this:


k9xh.png


 


Your folder probably does not have the SRC file already, but we'll get to that later.


What you can do to make things easier is just make an alias of the tribot folder and store it on your desktop or something.


hwod.png


 


Okay So now that we know where our tribot folder is, we're going to use the directory of the folder to set the location of our java project. Which for me would thus be: 


 


'/Users/*USERNAME*/Library/Application Support/tribot'


jpqs.png


 


After that click next. You'll get a window that looks somewhat like this: (I can't show you exactly how you have it because my tribot is already set-up with eclipse)


70qo.png


 


alright so under the 'Source' section. You won't already see tribot/src like I have, but we're going to create it now. click on 'add folder'


A new window will ask you to select your source folder. If the 'src' folder is not there, just click create new folder and name it 'src'. Then select it en press finish or okay.


bscr.png


 


 


 


 


Now we go to the Order and Export tab, and we're going to check everything we have in there.


n5ay.png


 


Now you can click finish, and your project is created. :)


 


 


Now what we still need to do is this:


click on your project and select new > package. make sure it's under the src folder. (like on the image). Then name it 'scripts' And press okay.


6jpb.png


 


 


In this scripts package is where your future scripts will be! if you want to create a new script, just right click on the scripts package in your project and select new > class


a6rm.png


 


Now that you have a new class file, this is where your code would go. If you want to test if everything works now I suggest you copy this into your first little script, (it's the basic skeleton)



package scripts;
 
import org.tribot.script.Script;
import org.tribot.script.ScriptManifest;
 
@ScriptManifest(authors = { "Boolean" }, category = "Woodcutting", name = "woodcutter")
public class test extends Script{
 
 
 
@Override
public void run() {
 
println("hello world");
}
 
 
}

like this: 


spdf.png


 


Note that if you just copy my code, your class name should be the same name as your .java file.


More detailed: see how 'public class '''''test'''' extends script is the same name as the .java file '''''test'''''.java under the scripts package. This must be the same or the script won't compile. Save your script.


 


 


Go ahead and open your bot now, open your scripts folder in your bot. Do you see your script? probably not. because the script has not been compiled yet. in other words: there has not yet been made a class file of your .java files. This means that although you have given in the code, your computer has not done anything with it yet, and we'll need to fix that.


 


back in your eclipse, you want to go to eclipse > preferences


pzk7.png


 


then you want to go to the section 'workspace' and check build automatically. What this does it that your script will now automatically compile when you click save in eclipse.


jp7u.png


 


Open your scripts folder again, your test script should now be visible under the section woodcutting or whatever section you chose. Try running it and it will print 'hello world" in the console. After that the script stops.


 


The 'build automatically' allows us to go to eclipse whilst the bot is still open, and just change whatever you want in your script. Lets say we'll change "hello world" to "hello tribot". Just press save and rerun your script, the console will now print "hello tribot".


 


Because it's compiling so fast and easy, this is a really good way to fix little things in your scripts. Instead of opening and re-opening the bot we lose less time because we just have to press save to compile! Which spares us a lot of time.


 


 


That's about it, I hope you get your bot to work and that everything is clear to you now. Thanks for reading!


 


1 person likes this

Share this post


Link to post
Share on other sites

Anyone tell me where I can find the tribot folder on Windows?

 

type command: %AppData% in "run". Then you'll see ".tribot" folder in there

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.