potatoer Posted October 25, 2015 Share Posted October 25, 2015 (edited) localWalker.walkPath(Position[] path); To get this to work what api do i have to import? i currently have: import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.Area; import java.awt.*; I also have the postions set up i read through osbot.org/api and couldn't find it. Thanks for your help Edited October 25, 2015 by potatoer Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 25, 2015 Author Share Posted October 25, 2015 To get this to work what api do i have to import? i currently have: import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.Area; import java.awt.*; I also have the postions set up i read through osbot.org/api and couldn't find it. Thanks for your help Uh, i'm not sure. If you try writing postition, it should underline in red and it will give you the option to import the relevant import. apa 1 Quote Link to comment Share on other sites More sharing options...
potatoer Posted October 25, 2015 Share Posted October 25, 2015 Uh, i'm not sure. If you try writing postition, it should underline in red and it will give you the option to import the relevant import. apa It worked but i had to create a new project for some reason thank you for all the help. My script is just getting the finishing touches. 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 25, 2015 Author Share Posted October 25, 2015 It worked but i had to create a new project for some reason thank you for all the help. My script is just getting the finishing touches. glad you got it sorted would be awesome to see a screenshot of the script in action! apa Quote Link to comment Share on other sites More sharing options...
potatoer Posted October 26, 2015 Share Posted October 26, 2015 glad you got it sorted would be awesome to see a screenshot of the script in action! apa It appears i didn't get it sorted i've compiled the code with no errors or warnings but when i run it i get [ERROR][Bot #1][10/25 09:03:35 PM]: Error in script executor! java.lang.NullPointerException at Main.onLoop(Main.java:52) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(em:109) at java.lang.Thread.run(Unknown Source) [INFO][Bot #1][10/25 09:03:35 PM]: Thanks for running my Garlic Grabber! [INFO][Bot #1][10/25 09:03:35 PM]: Script Garlic Grabber has exited! source code: here i hope i'm not pestering you :] Quote Link to comment Share on other sites More sharing options...
The Great Money1 Posted October 26, 2015 Share Posted October 26, 2015 Hi im having problem i cant get the eclipse file to show up on my c:/ Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 26, 2015 Author Share Posted October 26, 2015 It appears i didn't get it sorted i've compiled the code with no errors or warnings but when i run it i get [ERROR][Bot #1][10/25 09:03:35 PM]: Error in script executor! java.lang.NullPointerException at Main.onLoop(Main.java:52) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(em:109) at java.lang.Thread.run(Unknown Source) [INFO][Bot #1][10/25 09:03:35 PM]: Thanks for running my Garlic Grabber! [INFO][Bot #1][10/25 09:03:35 PM]: Script Garlic Grabber has exited! source code: here i hope i'm not pestering you :] Don't worry about pestering me!: ) As for the code, FORMAT IT! From first glance it looks like you've got the bracket alignment wrong in the getState() switch. It's quite hard to read tho as it's all over the place. but generally, an NPE is an easy error to fix. It just means you forgot to null check something - in this case specifically on line 52 (as it says in the stacktrace). Take a look at that line and see if you can figure out what's wrong! (hint - nullcheck the cupboard ) apa Quote Link to comment Share on other sites More sharing options...
potatoer Posted October 26, 2015 Share Posted October 26, 2015 (edited) Don't worry about pestering me!: ) As for the code, FORMAT IT! From first glance it looks like you've got the bracket alignment wrong in the getState() switch. It's quite hard to read tho as it's all over the place. but generally, an NPE is an easy error to fix. It just means you forgot to null check something - in this case specifically on line 52 (as it says in the stacktrace). Take a look at that line and see if you can figure out what's wrong! (hint - nullcheck the cupboard ) apa Thanks it got the script running and more problems show up it doesn't seem to follow any order i have put in the script i put some labeling in this paste after starting in the bank it just wants to go up the stairs for some reason if i start in the room with cupboard it will pick and walk back until it gets close to the bank which has a house across from it with stairs but it doesn't always make it down the stairs after picking . Edited October 26, 2015 by potatoer Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 27, 2015 Author Share Posted October 27, 2015 Thanks it got the script running and more problems show up it doesn't seem to follow any order i have put in the script i put some labeling in this paste after starting in the bank it just wants to go up the stairs for some reason if i start in the room with cupboard it will pick and walk back until it gets close to the bank which has a house across from it with stairs but it doesn't always make it down the stairs after picking . The best way for you to learn is to figure this one out for yourself. That being said, i'll point you in the right direction By all means ask more questions if you get stuck btw! So. Looking at your code, you're writing it like a recipe. While in theory this should work, due to a range of the osbot api's structure and general good coding form, writing like a recipe is a bad way to do it. What you want is more if statements. So for example, in your walk to bank state, you're instantly telling it to walk path4 (whatever that is). But perhaps add a check to see if it should / needs to walk this path. If you add this kind of system for every section of the journey and make sure that there's no overlapping, you should be good to go apa Quote Link to comment Share on other sites More sharing options...
potatoer Posted October 30, 2015 Share Posted October 30, 2015 The best way for you to learn is to figure this one out for yourself. That being said, i'll point you in the right direction By all means ask more questions if you get stuck btw! Thanks, i appreciate you not just giving me the answer. I solved the problem while taking a break, making another script now i got two working scripts. 2 Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 30, 2015 Author Share Posted October 30, 2015 Thanks, i appreciate you not just giving me the answer. I solved the problem while taking a break, making another script now i got two working scripts. Wooooo! glad you got this issues sold. By all means feel free to ask more questions tho, feel free to pm me too gl! apa Quote Link to comment Share on other sites More sharing options...
Sebastian Posted November 10, 2015 Share Posted November 10, 2015 Bro! Thanks for this. I'm quite skilled in Java, but this was just what i needed! Made this tea picking bot just by typing everything. No copy pasta. Just to analyze what everything is. Finished this tutorial, and now making an advanced woodcutting script! I watched hoppyc0ding's video, but was very upset that his video is outdated. But then i tried this, and works like a charm. Sir, you have just created another programmer! Thanks bro, and you will see me posting scripts! - Sebastian. 1 Quote Link to comment Share on other sites More sharing options...
kitiria Posted November 12, 2015 Share Posted November 12, 2015 can someone help me? i tried to make this script to a woodcutting script, but the character doesnt chop.... tell me what im doing wrong please, import org.osbot.rs07.api.model.Entity;import org.osbot.rs07.script.Script;import org.osbot.rs07.script.ScriptManifest;import java.awt.*;@ScriptManifest(author = "Sgt.Roadkill", info = "My first woodcutting script", name = "Woodcutter", version = 0.1, logo = "")public class main extends Script{ @Override public void onStart(){ log("Welcome to my First script for WOODCUTTING."); log("If you experience any issues with the script, please report them to me ;)"); log("Enjoy the script, gain some WOODCUTTING levels."); } private enum State { CHOP, DROP, WAIT }; private State getState() { Entity Willow = objects.closest("Willow"); if (!inventory.isEmpty()) return State.DROP; if (Willow != null) return State.CHOP; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case CHOP: Entity Willow = objects.closest("Willow"); if (Willow != null) { Willow.interact("Chop down"); } break; case DROP: inventory.dropAll("Willow logs"); break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit(){ log("Thanks for running my WOODCUTTING script"); } @Override public void onPaint(Graphics2D g){ }} Quote Link to comment Share on other sites More sharing options...
Apaec Posted November 12, 2015 Author Share Posted November 12, 2015 can someone help me? i tried to make this script to a woodcutting script, but the character doesnt chop.... tell me what im doing wrong please, import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Sgt.Roadkill", info = "My first woodcutting script", name = "Woodcutter", version = 0.1, logo = "") public class main extends Script{ @Override public void onStart(){ log("Welcome to my First script for WOODCUTTING."); log("If you experience any issues with the script, please report them to me ;)"); log("Enjoy the script, gain some WOODCUTTING levels."); } private enum State { CHOP, DROP, WAIT }; private State getState() { Entity Willow = objects.closest("Willow"); if (!inventory.isEmpty()) return State.DROP; if (Willow != null) return State.CHOP; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case CHOP: Entity Willow = objects.closest("Willow"); if (Willow != null) { Willow.interact("Chop down"); } break; case DROP: inventory.dropAll("Willow logs"); break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit(){ log("Thanks for running my WOODCUTTING script"); } @Override public void onPaint(Graphics2D g){ } } are you sure the name is 'Willow' not 'Willow tree'? if you get the name wrong, it will always be null and hence won't get into the chop state. apa Quote Link to comment Share on other sites More sharing options...
Sebastian Posted November 14, 2015 Share Posted November 14, 2015 (edited) Replace this: if (Willow != null) { Willow.interact("Chop down"); } With this: if (Willow != null) { if (Willow.isVisible()) { Willow.interact("Chop down"); } else { sleep(random(500, 700)); } } The Willow.isVisible will check if the willow actually is visible. If it's visible, then chop. Else, it's gonna sleep for 500 till 700 milliseconds. Randomly. Hope that works buddy. are you sure the name is 'Willow' not 'Willow tree'? if you get the name wrong, it will always be null and hence won't get into the chop state. apa Nope, the name for a willow tree is Willow. But i'm sure you already knew that. Edited November 14, 2015 by OSRS Sebastian 1 Quote Link to comment Share on other sites More sharing options...