mustang guy Posted August 17, 2015 Share Posted August 17, 2015 (edited) Make sure you install the JDK (Java Developer Kit) before step 1. Having Java installed is not enough. You need access to the libraries. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html NOTE: Download the x86 version NOT the 64 bit version. Otherwise you will not be able to attach with the mirror client when running scripts. I found out the hard way. 64 bit and mirror client do not work well together as of now... Edited August 22, 2015 by mustang guy Quote Link to comment Share on other sites More sharing options...
poephoofdos Posted August 18, 2015 Share Posted August 18, 2015 Thanks man, you got me into scripting! I have a problem though, yesterday i made a script that worked perfectly, but now i tried to make another one and it won't show up in the Script Selector even though the other one does. They're in the same location and im pretty sure the Manifest is correct. Any idea what i'm doing wrong? Screenshot: http://puu.sh/jFYaQ/72737b9bdf.png 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 18, 2015 Author Share Posted August 18, 2015 Thanks man, you got me into scripting! I have a problem though, yesterday i made a script that worked perfectly, but now i tried to make another one and it won't show up in the Script Selector even though the other one does. They're in the same location and im pretty sure the Manifest is correct. Any idea what i'm doing wrong? Screenshot: http://puu.sh/jFYaQ/72737b9bdf.png close osbot, delete all files in your script directory, open osbot, reexport script, refresh scripts, voila! apa PS i'm glad I got you into scripting hopefully things go well and good luck don't give up! apa Quote Link to comment Share on other sites More sharing options...
poephoofdos Posted August 18, 2015 Share Posted August 18, 2015 It worked, thanks! And I study application development, which is in c# but it's close enough, so it's not too hard. 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 18, 2015 Author Share Posted August 18, 2015 It worked, thanks! And I study application development, which is in c# but it's close enough, so it's not too hard. Awesome look forward to seeing some awesome scriptzzzz Quote Link to comment Share on other sites More sharing options...
levvyy Posted August 26, 2015 Share Posted August 26, 2015 (edited) Hi, Im trying to get into scripting. The thing that confuses me is how to find out what everything is called like i know how to create an entity or an npc or grounditem now and interact with it, but every time i want to try out something new like for instance check if the inventory is full i have no idea how to go about and find out what code i should use. like. i read from the API public boolean dropAllExcept(int... ids)Drops all the items in the inventory excluding items with the ids passed.Parameters:ids - Item ids to ignore when dropping.Returns:True if the items were dropped successfully. so naturally i put: public int onLoop() throws InterruptedException { switch (getState()) { case COLLECT: break; case DROP: public boolean dropAllExcept(526); break; case WAIT: break; } return random(200, 300); but it gives me an error... tell me what im doing wrong. Edited August 26, 2015 by levvyy Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 26, 2015 Author Share Posted August 26, 2015 Hi, Im trying to get into scripting. The thing that confuses me is how to find out what everything is called like i know how to create an entity or an npc or grounditem now and interact with it, but every time i want to try out something new like for instance check if the inventory is full i have no idea how to go about and find out what code i should use. like. i read from the API so naturally i put: public int onLoop() throws InterruptedException { switch (getState()) { case COLLECT: break; case DROP: public boolean dropAllExcept(526); break; case WAIT: break; } return random(200, 300); but it gives me an error... tell me what im doing wrong. It might be worth taking a look at some basic java. This will give you understanding of these kinds of things. public and boolean are what the method is defined by. But you want to use the name of the method to call it so it would be inventory.dropAllExcept(id); boolean tells you it returns true or false, much like if it said int it would return 1, 2, 3 etc. apa Quote Link to comment Share on other sites More sharing options...
levvyy Posted August 26, 2015 Share Posted August 26, 2015 ah wait so the class is inventory, and the method im calling is dropAllExcept(526) so i should do : class.methodtocall() ?? Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 26, 2015 Author Share Posted August 26, 2015 ah wait so the class is inventory, and the method im calling is dropAllExcept(526) so i should do : class.methodtocall() ?? Pretty much yea so for example with bank: bank.withdraw("rune boots"); //or whatever the item and inventory: inventory.dropAll("rune boots"); //or whatever the name of the item to drop apa Quote Link to comment Share on other sites More sharing options...
levvyy Posted August 26, 2015 Share Posted August 26, 2015 I understand, thanks but case DROP: Inventory.dropAllExcept("bones"); break; gives me this error Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 26, 2015 Author Share Posted August 26, 2015 (edited) I understand, thanks but case DROP: Inventory.dropAllExcept("bones"); break; gives me this error inventory NOT Inventory edit: you can also give urself more workspace in eclipse by closing the various tabs to the right (task list etc) apa Edited August 26, 2015 by Apaec Quote Link to comment Share on other sites More sharing options...
levvyy Posted August 26, 2015 Share Posted August 26, 2015 (edited) right, so if i find methods from parent classes i can use them on the subclass too? so the method "isfull" that is used on itemcontainer class, is inherited by inventory? so i can use inventory,isFull() which will return a bool? edit: thanks for helping me out. I am starting my computer sciences stody next week and wanted to brush up on java before i started. i thought scripting might be a nice way to get into it. you've taught me something and i thank you for it. I was able to create a simple Bone collector + burier script that detects when it picks up something odd and drops it. source import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.model.GroundItem; import java.awt.*; @ScriptManifest(author = "Levvyy", info = "Boneburierv1.0", name = "Bone Burier", version = 0, logo = "") public class main extends Script { @Override public void onStart() { log("Initializing Script"); } private enum State { COLLECT, DROP, FULL, WAIT }; private State getState() { if (inventory.isFull()) return State.FULL; if (!inventory.isEmptyExcept(526)) return State.DROP; if (inventory.isEmptyExcept(526)) return State.COLLECT; return State.WAIT; } @Override public int onLoop() throws InterruptedException { GroundItem BONES = groundItems.closest("bones"); switch (getState()) { case COLLECT: BONES.interact("take"); break; case DROP: inventory.dropAllExcept("bones"); break; case FULL: while(!inventory.isEmpty()){ inventory.interact("bury", "bones"); } break; case WAIT: break; } return random(200, 300); } @Override public void onExit() { log("Thanks for running my Tea Thiever!"); } @Override public void onPaint(Graphics2D g) { } } Edited August 26, 2015 by levvyy 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 26, 2015 Author Share Posted August 26, 2015 so i can use inventory,isFull() which will return a bool? yes. Quote Link to comment Share on other sites More sharing options...
hunterl31 Posted August 31, 2015 Share Posted August 31, 2015 Hey man thanks for the awesome tutorial! I am just now getting back in to coding with osbot and im having an issue where scripts that i run dont really start. i even copied the code in your tutorial line for line to see if it was an issue with my code and still the same error. Have you ever heard of this and do you know of a fix? 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 31, 2015 Author Share Posted August 31, 2015 Hey man thanks for the awesome tutorial! I am just now getting back in to coding with osbot and im having an issue where scripts that i run dont really start. i even copied the code in your tutorial line for line to see if it was an issue with my code and still the same error. Have you ever heard of this and do you know of a fix? Hey, there have recently been some server errors due to ddos attacks. Maybe this problem you're experiencing is related? otherwise i'm not too sure as my stuff seems to be working ok apa Quote Link to comment Share on other sites More sharing options...