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.


  • Content count

  • Joined

  • Last visited

  • Feedback


Community Reputation

2 Neutral

About Boolean

  • Rank
    New Botter
  1. It's different but not more complicated
  2. Thank you, will also look into that when i get home
  3. Thanks, will check tonight
  4. Why would this: private void fight() {RSNPC[] goblin = NPCs.findNearest(goblinFilter);if (goblin[0].isOnScreen())goblin[0].click("attack");elseCamera.turnToTile(goblin[0].getPosition());} FilterGroup<RSNPC> goblinFilter = new FilterGroup<RSNPC>() {public boolean accept(RSNPC n) {if (n.getName().contains("oblin") && !n.isInCombat())return true;return false;}}; return the most nearby npc even if the name of this npc does not contain 'oblin'? (i'm making a goblin killer just to get a hang of scripting) Is there another way to determine npcs instead of a filter? Thanks in advance! (Full script so far: http://pastebin.com/Zu2pxghm )
  5. 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: 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 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). 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: 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. 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' 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) 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. Now we go to the Order and Export tab, and we're going to check everything we have in there. 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. 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 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: 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 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. 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!
  6. Boolean's Basic Java Tutorial About me: Hi, my name is Boolean, I go to the university of Hasselt in Belgium where I study informatics. I made a summary of the java courses I had this trimester. I thought I'd share it with you guys. My goal is to gain scriptwriter rank. In the early days I made scripts for rsbot, quirlion, rsbuddy and Kbot, but I have taken a long break from scripting. Now I just feel like giving it a go again. Hope you will enjoy my tutorial, and hope that this will contribute on my way to scriptwriter rank. (I haven't really looked in the TriBot api yet, but when I get VIP (in 3 days or so) I'll start to take things seriously.) Introduction: Programming is something wonderful, but it can also be pretty complicated. I decided to build this tutorial for Java. Our classes are focused around algorithms, a logical sequence of mathematical expressions. Programming is the tool we use to communicate with computers, and it makes us able to create and prove algorithmic structures. Programming Language 101 So what’s the difference between natural languages and programming languages? A natural language has ambiguity. A programming language needs to be strict. There can’t be any ambiguity.Syntax of a language: the structured rules of how to build expressions. Backus-Naur form is a set of rules that describe a programming language. The disadvantage is that they aren’t clear for the users of a programming language. That’s why syntax diagrams exist. They are much simpler to follow.Semantic of a language: the meaning of a syntactically correct sentence.Logic of a language: does the meaning of a sentence actually make any sense? Although Computer science is a science, programming is an art that can’t be cast into simple rules. So how do we start when we have a problem/exercise/exam to solve? The first thing to do: is to understand what the problem actually is. Do not start coding first! Specify the input and output of the problem. This could be: input: a number, output: absolute value of that number, or the faculty of that number. What do you know about the problem? What could you use as variables? Think how the algorithm would work. This step is more complicated. Document your code! Comments are almost necessary! Coding is hard, but that shouldn't make it hard to just read the code. deliver CLEAR work. Beginning in Java: First of: I want to show you how a java script is constructed. A java file is a declared class that covers your code. This class is used to call the code thats in between the brackets. In a normal java file we have a 'main' method. In the method the actions of your code will be performed. But more about that later. If you're really new to java, this is just to give you an idea of what the skeleton of a script looks like. public class test{ public static void main(String[] args){ System.out.println("Hello World"); }}Here we have the class file, named 'test'. In the class is the 'main' method, and in there we have our action: printing out "hello world" to the console. Variables: Variable: containers that can contain data, which can change over time. Variable type: the nature (what it represents, how it represent it’s data ) of certain data. There are 8 primitive types (short, int, long,byte, float, double, boolean and char), there are also class types. These are somewhat too advanced to discuss in this course (for those who want to know more / find this course easyish, look up Object Oriented Programming). But we will discuss the String class. (Strings are important since they are used often and can be of variable size) Variable declaration: (int a;) we let the computer know we want to use a variable of type int, so the computer can reserve some memory for our variable, but we don’t place any info in this memory. Variable initialization: giving a variable a value for the first time: bv int a = 5; or b = 5;. You can initialize variables immediately when you declare the variable or do it later.Constants: (not java constants) variables that can’t change value, we use the keyword “final”. ex: final int A = 5; One rule we have: constant variables are CAPITALISED.Expressions: formula in which U use variables. The result from an expression will always be of the same type. Operations: You can use 4 different kind of operations.The "/" operator (division) the "%" operator (modulo). returns the rest of an integer division. The "*" operator (multiplication) The "-" operator (subtraction) The "+" operator (addition)Priority rules (high to low) The parenthesis '(' and ')' Identity and sign change Multiplication, division and modulo Addition and subtraction Assignments: Allocation/assignment: a = b (the value of b will be copied into the memory of a), a = b = c is equal to a = (b = c), assignments go from right to left. You can combine the = with operators (we have += , *= , /=, %= , -=) Do note: a += b –c is equal to a = a + (b-c). First the right hand gets evaluated, that gets added to a. So a *= 5 + 3 is equal to a = a * 8 (new a = old a * 8). A computer program runs statement by statement. So let’s say we want to interchange the value of 2 variables. We can’t do: x = y; y =x; What happens? The value of x becomes a copy of the value of y. Then we assign the value of x into y. But we basically are replacing the value of y with the value of y. But what we can do://lets say we have 2 integers x and y, with values 1 and 2 and we want to switch their values.int x = 1;int y = 2; int help;help = x;x = y;y = help;We declared a new variable 'help' to assist us when exchanging the values of x and y. User Input:Note that when I say user input I don't mean this tribot-script related. Tribots api has it's own methods for user input. I'll be covering the Scanner class which is built in in Java. import java.util.Scanner; public class test{ public static void main(String[] args){ int x; Scanner s = new Scanner(System.in); x = Scanner.nextInt(); // Scanner.nextLine() for strings // Scanner.nextDouble() for doubles // ... }}We've declared s as our Scanner. in between the '()' goes System.in, because it's an input to our system. to call input we use the line Scanner.nextTYPE(); different variables demand different forms of input (strings, ints, longs, doubles...). In TriBot we use a GUI 'graphical user interface' to question input. As this is pretty intermediate-advanced, it won't be covered in this tutorial. StatementsStatements are used to let your script do certain things in a certain order. These statements are basically the same in any other scripting language and even someone that has never programmed before should know what an 'if-statement' is. I'll be covering most of the statements now. If-Else statementsIf statement evaluate if a condition is true or false. if (condition){ statement; }The statement can be a single statement or a block of code. The if statement will only execute it’s code if it’s condition evaluates to true. Note: don’t forget the () surrounding the condition. if (condition){ statement; }else{ statement2 }In here if the condition evaluates, statement2 will be executed (statement2 can also be either a single statement or a block of code). Note: if no braces are used with an if, only a single statement will execute. if (condition) statement; statement2; Don’t be fooled by this bad indentation, statement2 will always execute. a good indentation makes a good and clear program. It is a convention that, if the statement contains only 1 line of code, we don't use the brackets { } to cover that line of code. if no brackets are found, the if-statement will only contain the line of code right after the if itself. This is the same for any other type of statement. If-else statements can be nested: if (condition){ statement; }else{ if (condition){ statement; }else{ statement2; } } The above code, the else statement contains another if-else block. The better way to write this (read: do it like written below): if (condition){ statement; }else if(condition){ statement; }else{ statement2; }Be wary: if (condition){ if (condition){ statement; } }else{ statement; } The else belongs to the nested if, not the outside if! The condition: This is a boolean condition. You can use: == (compare, don’t mistake it for =, which is an assignment) < <= > >= != (not equal) Looping statementsWhat we mean by looping is a statement that does a certain action for as long as we want that action to be performed. While statement:The repetition statement. It will repeat it’s block of code, as long as the condition evaluates to true.while (condition) statement;A statement, again, can be a single statement or a block of code (braces). It’s possible to nest while loops and nest if’s in while’s and the other way around. Do-While statement: A do while is very similar to a regular while loop. The difference is that a while will first check it’s condition and then perform its statement. A do while will perform its statement, and then it’ll check its condition. In other words: A do-while will at least perform its statement once. do statement; while (condition); For statement: The for statement is created from3 parts. The first thing it’ll do is it “initfor”. Check its condition. After that it’ll perform its statement. Then its updatefor. And finally, check it’s condition. for (initfor; condition; updatefor) statement; //example: for (int i = 1; i < 11; i++) System.out.println(i); //this for would print 1 to 10 A for loop is just a specialized while loop. The equivalent while loop would be: initfor; while (condition){ statement; updatefor; } Note: it’s possible to declare variables inside the initfor (eg: int a = 0;) This decreased the visibility of that variable (see later chapter) Break and continue: A break will stop a certain block of code. So using a break, will stop the while from executing. A continue will end that iteration. Example: while (condition){ if (othercondtion) break; // ends the while otherstatements; }while (condition){ if (othercondtion) continue; //goes back to start of while otherstatements; //without doing these statements } Only use breaks and continues when they increase readability. Don’t use them to break out of nested loops ( break through multiple loops) Switch statementA switch statement is to be used instead of a long chain of if-else statements which rely on 1 variable. This variable needs to be an number. (it can also be a string, but I don’t know if the professor will allow this) The switch statement will compare the value of the given numeric variable to the constants defined by the cases. If it finds a match it’ll execute the code belonging to that case. But without breaks, it will continue executing code. In the below code, when number == 1, it’ll execute statement5 and statement, then I’ll break. Without breaks, statement2, statement3 and statement4 would also be executed. You can use this to your advantage, like in the example to let the switch execute statement in 2 cases (both when number ==1 and number == 2 statement will be executed. The default is executed when none cases match number. switch (number){ case 1: break; case 2: break; case 3: break; case 4: break; default: break; } COMING TOMORROW:datatypesmethods
  7. Solved by installing latest version of JDK. Mods can close/move thread.
  8. Error i get: [15:14:18] CONSOLE STARTED[15:14:18] TRiBot 7.53_0[15:14:18] Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future[15:14:18] Initial Settings Loaded[15:14:18] Exception in thread "TSV" java.lang.NoClassDefFoundError: sun/security/ssl/SSLSocketImpl[15:14:18] Using SID: r6Sbsn5aeqq0DXW99CB6h1FfSyYTKUfYtBXuUs8eQCLFTlRNYCG[15:14:18] at obf.BD.checkCreateClassLoader(qc:1446)[15:14:18] at java.lang.ClassLoader.checkCreateClassLoader(ClassLoader.java:177)[15:14:18] at java.lang.ClassLoader.(ClassLoader.java:206)[15:14:18] at sun.reflect.DelegatingClassLoader.(ClassDefiner.java:54)[15:14:18] at sun.reflect.ClassDefiner$1.run(ClassDefiner.java:42)[15:14:18] at java.security.AccessController.doPrivileged(Native Method)[15:14:18] at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:39)[15:14:18] at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)[15:14:18] at java.security.AccessController.doPrivileged(Native Method)[15:14:18] at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)[15:14:18] at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:76)[15:14:18] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)[15:14:18] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)[15:14:18] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)[15:14:18] at java.lang.Class.newInstance0(Class.java:357)[15:14:18] at java.lang.Class.newInstance(Class.java:310)[15:14:18] at java.security.Provider$Service.newInstance(Provider.java:1221)[15:14:19] at sun.security.jca.GetInstance.getInstance(GetInstance.java:220)[15:14:19] at sun.security.jca.GetInstance.getInstance(GetInstance.java:202)[15:14:19] at java.security.Security.getImpl(Security.java:688)[15:14:19] at java.security.MessageDigest.getInstance(MessageDigest.java:233)[15:14:19] at sun.security.util.ManifestEntryVerifier.setEntry(ManifestEntryVerifier.java:117)[15:14:19] at java.util.jar.JarVerifier.beginEntry(JarVerifier.java:156)[15:14:19] at java.util.jar.JarVerifier$VerifierStream.(JarVerifier.java:419)[15:14:19] at java.util.jar.JarFile.getInputStream(JarFile.java:405)[15:14:19] at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:708)[15:14:19] at sun.misc.Resource.cachedInputStream(Resource.java:61)[15:14:19] at sun.misc.Resource.getByteBuffer(Resource.java:144)[15:14:19] at java.net.URLClassLoader.defineClass(URLClassLoader.java:256)[15:14:19] at java.net.URLClassLoader.access$000(URLClassLoader.java:58)[15:14:19] at java.net.URLClassLoader$1.run(URLClassLoader.java:197)[15:14:19] at java.security.AccessController.doPrivileged(Native Method)[15:14:19] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)[15:14:19] at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)[15:14:19] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)[15:14:19] at java.lang.ClassLoader.loadClass(ClassLoader.java:295)[15:14:19] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)[15:14:19] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[15:14:19] at sun.security.jca.ProviderConfig$4.run(ProviderConfig.java:253)[15:14:19] at java.security.AccessController.doPrivileged(Native Method)[15:14:19] at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:244)[15:14:19] at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:224)[15:14:19] at sun.security.jca.ProviderList.getProvider(ProviderList.java:215)[15:14:19] at sun.security.jca.ProviderList.getService(ProviderList.java:313)[15:14:19] at sun.security.jca.GetInstance.getInstance(GetInstance.java:140)[15:14:19] at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)[15:14:19] at obf.Zd.(wf:696)[15:14:19] at obf.uF.run(xg:1313)[15:14:19] at java.lang.Thread.run(Thread.java:680)[15:14:19] Exception in thread "AWT-EventQueue-1" java.lang.NoClassDefFoundError: Could not initialize class obf.Zd[15:14:19] at obf.id.h(ao:81)[15:14:19] at obf.qg.run(xg:110)[15:14:19] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)[15:14:19] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)[15:14:19] at java.awt.EventQueue.access$400(EventQueue.java:82)[15:14:19] at java.awt.EventQueue$2.run(EventQueue.java:676)[15:14:19] at java.awt.EventQueue$2.run(EventQueue.java:674)[15:14:19] at java.security.AccessController.doPrivileged(Native Method)[15:14:19] at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)[15:14:19] at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)[15:14:19] at obf.XC.dispatchEvent(lo:31)[15:14:19] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)[15:14:19] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)[15:14:19] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)[15:14:20] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)[15:14:20] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)[15:14:20] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)[15:14:22] Done I'm using a early 2012 macbook pro (Mountain Lion) If anyone could tell me what to do i'd be really thankfull Thanks in advance!