mike3zx Posted August 18, 2020 Share Posted August 18, 2020 Thanks will definitely try to start something simple. Now with a woodcutting script or mining could I use a similar layout as this script but change some wording around to fit woodcutting. Inside of steal from Tea Stall it'd go to Chop Tree or Mine rock, can't remember what it's actually called in game off the top but my head. 1 Quote Link to comment Share on other sites More sharing options...
mike3zx Posted August 18, 2020 Share Posted August 18, 2020 (edited) Edit: Figured out pathing, just need to figure out how to search is the player is in a certain location. The video I watched used the method (getLocalPlayer) but it doesn't seem to work for OSBot. Where in the api should I be looking to find this? Edited August 18, 2020 by mike3zx Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 18, 2020 Author Share Posted August 18, 2020 2 hours ago, mike3zx said: Edit: Figured out pathing, just need to figure out how to search is the player is in a certain location. The video I watched used the method (getLocalPlayer) but it doesn't seem to work for OSBot. Where in the api should I be looking to find this? Here's a link to the OSBot API: https://osbot.org/api/ To check if you're at a location, i'd take a look at the Area API: https://osbot.org/api/org/osbot/rs07/api/map/Area.html Then, you can do something like: Area someArea = new Area(500,600,700,800); if (someArea.contains(myPlayer())) { log("hello!"); } 1 Quote Link to comment Share on other sites More sharing options...
Weep Posted August 22, 2020 Share Posted August 22, 2020 Hi, is this guide still relevant as of August 2020? Also, this is for Old School RS, not RS3, right? Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 23, 2020 Author Share Posted August 23, 2020 22 hours ago, Weep said: Hi, is this guide still relevant as of August 2020? Also, this is for Old School RS, not RS3, right? Yep, should be mostly up to date. If you spot anything that you suspect might be outdated, please let me know And yes, this is for OSRS Apa Quote Link to comment Share on other sites More sharing options...
mitsuki Posted August 26, 2020 Share Posted August 26, 2020 To interact with a fishing spot, would you use getNPCs as apposed to getObjects? Quote Link to comment Share on other sites More sharing options...
mitsuki Posted August 26, 2020 Share Posted August 26, 2020 I'm stuck with getting my script to work. It just stands still import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Mitsuki", info = "AutoShrimper", name = "AutoShrimper", version = 0, logo = "") public class tanner extends Script { @Override public void onStart() { log("Let's get started!"); } @Override public int onLoop() throws InterruptedException { NPC FishingSpot = this.getNpcs().closest("Net Fishing spot"); if (getInventory().contains("Raw shrimps")) { getInventory().drop("Raw shrimps"); } if (getInventory().contains("Raw anchovies")) { getInventory().drop("Raw anchovies"); } else if (FishingSpot != null && !myPlayer().isAnimating()) { FishingSpot.interact("Net Fishing spot"); } return random(200, 300); } @Override public void onExit() { log("Thanks for running my AutoShrimper!"); } @Override public void onPaint(Graphics2D g) { } } Anything you notice to be wrong? Cheers Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 26, 2020 Author Share Posted August 26, 2020 42 minutes ago, mitsuki said: I'm stuck with getting my script to work. It just stands still import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Mitsuki", info = "AutoShrimper", name = "AutoShrimper", version = 0, logo = "") public class tanner extends Script { @Override public void onStart() { log("Let's get started!"); } @Override public int onLoop() throws InterruptedException { NPC FishingSpot = this.getNpcs().closest("Net Fishing spot"); if (getInventory().contains("Raw shrimps")) { getInventory().drop("Raw shrimps"); } if (getInventory().contains("Raw anchovies")) { getInventory().drop("Raw anchovies"); } else if (FishingSpot != null && !myPlayer().isAnimating()) { FishingSpot.interact("Net Fishing spot"); } return random(200, 300); } @Override public void onExit() { log("Thanks for running my AutoShrimper!"); } @Override public void onPaint(Graphics2D g) { } } Anything you notice to be wrong? Cheers Hey, That code looks good. I'm not exactly sure about fishing spots, though they may be NPCs rather than RS2Objects, as you assume. I think your problem might be with your definition strings. Are you sure that 'Net Fishing spot' is the interaction action? This is case sensitive and has to be exactly correct. Likewise, are you sure that the object (NPC) is called 'Net Fishing spot'? again, this has to be exactly correct. -Apa Quote Link to comment Share on other sites More sharing options...
mitsuki Posted August 26, 2020 Share Posted August 26, 2020 I figured it out after. I never checked if the inventory was full, and therefore, the else if statement never ran. Cheers for your speedy response though. Any advice on how to start learning to move the player? like walking to a specific spot, or going to the bank? Cheers for all of the help dude, such doge Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 26, 2020 Author Share Posted August 26, 2020 3 hours ago, mitsuki said: I figured it out after. I never checked if the inventory was full, and therefore, the else if statement never ran. Cheers for your speedy response though. Any advice on how to start learning to move the player? like walking to a specific spot, or going to the bank? Cheers for all of the help dude, such doge Hey, Great, sounds like good progress - baby steps! To learn this stuff, take it one step at a time, e.g. 'how do I walk to a tile'. Then think about areas, recording paths, webwalking. All of these can be learnt about through trial and error, and through reading the API. As ever, let me know if you have any questions or need any help. Always happy to reply; I understand the difficulty of this learning curve so ask as many questions as you can! -Apa Quote Link to comment Share on other sites More sharing options...
mitsuki Posted August 27, 2020 Share Posted August 27, 2020 Ahh okay, thank you. Just reading the api seems like a nightmare, just trying to work out how to use it. I found this line of code to create an area: public Area(int x1, int y1, int x2, int y2) Would you essentially do this?: public Area(3000 x1, 3000 y1, 3100 x2, 3100 y2) and it would make a square area within 3000 x, 3000 y - 3100 x, 3000 y - 3100 x, 3100 y - 3000 x, 3100 y ? and I also can't tell how to name the area, or do you do something like: Lumbridge == public Area(3000 x1, 3000 y1, 3100 x2, 3100 y2) Is there a tutorial on how to read the api? Thank you dude Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 27, 2020 Author Share Posted August 27, 2020 57 minutes ago, mitsuki said: Ahh okay, thank you. Just reading the api seems like a nightmare, just trying to work out how to use it. I found this line of code to create an area: public Area(int x1, int y1, int x2, int y2) Would you essentially do this?: public Area(3000 x1, 3000 y1, 3100 x2, 3100 y2) and it would make a square area within 3000 x, 3000 y - 3100 x, 3000 y - 3100 x, 3100 y - 3000 x, 3100 y ? and I also can't tell how to name the area, or do you do something like: Lumbridge == public Area(3000 x1, 3000 y1, 3100 x2, 3100 y2) Is there a tutorial on how to read the api? Thank you dude Hey, These are methods of the Area class. 'public Area' is the constructor: it's saying that you can construct an Area with four integers. The description here should be sufficiently explanatory. You would construct an area as follows: public Area myArea = new Area(100, 200, 300, 400); where the bottom left tile is (100,200), and the top right tile is (300, 400). Here, 'public' is just the access modifier, public is fine in this context. Alternatives include 'private' and 'protected', but I wouldn't worry about those too much for now. You can then do handy stuff like checking if you're in the area: if (myArea.contains(myPlayer())) { log("hi!"); } etc. There isn't a tutorial on how to read the API (to my knowledge) - it is based on javadocs so the layout is standard, and it just tells you classes and methods, there's not a lot more to it. In general, the left hand pane will list the important classes that you will need. Then, when you select a class (e.g. 'Area'), you will be shown the constructor (if applicable) and the methods belonging to that class. If you're still struggling with this stuff (which is perfectly natural, this is a lot to take in in one go!), i'd strongly recommend giving this tutorial a read. The official oracle tutorials are great for getting the basics in understanding of this stuff: https://docs.oracle.com/javase/tutorial/java/index.html Best of luck! And let me know if you need anything else. Always happy to help. Apa Quote Link to comment Share on other sites More sharing options...
mitsuki Posted August 27, 2020 Share Posted August 27, 2020 13 minutes ago, Apaec said: Hey, These are methods of the Area class. 'public Area' is the constructor: it's saying that you can construct an Area with four integers. The description here should be sufficiently explanatory. You would construct an area as follows: public Area myArea = new Area(100, 200, 300, 400); where the bottom left tile is (100,200), and the top right tile is (300, 400). Here, 'public' is just the access modifier, public is fine in this context. Alternatives include 'private' and 'protected', but I wouldn't worry about those too much for now. You can then do handy stuff like checking if you're in the area: if (myArea.contains(myPlayer())) { log("hi!"); } etc. There isn't a tutorial on how to read the API (to my knowledge) - it is based on javadocs so the layout is standard, and it just tells you classes and methods, there's not a lot more to it. In general, the left hand pane will list the important classes that you will need. Then, when you select a class (e.g. 'Area'), you will be shown the constructor (if applicable) and the methods belonging to that class. If you're still struggling with this stuff (which is perfectly natural, this is a lot to take in in one go!), i'd strongly recommend giving this tutorial a read. The official oracle tutorials are great for getting the basics in understanding of this stuff: https://docs.oracle.com/javase/tutorial/java/index.html Best of luck! And let me know if you need anything else. Always happy to help. Apa You, sir, are a godsend. Thank you for having the patience to explain all of this to me. I actually know a load of basic Java, but never had to try reading an api, or doing anything too creative, other than creating arrays and lists and stuff for uni projects. Thank you so much dude Quote Link to comment Share on other sites More sharing options...
mitsuki Posted August 27, 2020 Share Posted August 27, 2020 (edited) Managed to get it to walk to the area that I want finally! The only problem was that it only walked to the area if it is a 10 second walk away or less. Managed to use webWalking instead, and it seems to work much better It walks to my area, and nets fish until the inventory is full, then drops them all! How would I give the user an option, say to choose to bank or not? That way, I could try to add code to walk to the closest bank, and bank it all Edited August 27, 2020 by mitsuki more info Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 27, 2020 Author Share Posted August 27, 2020 1 hour ago, mitsuki said: You, sir, are a godsend. Thank you for having the patience to explain all of this to me. I actually know a load of basic Java, but never had to try reading an api, or doing anything too creative, other than creating arrays and lists and stuff for uni projects. Thank you so much dude 38 minutes ago, mitsuki said: Managed to get it to walk to the area that I want finally! The only problem was that it only walked to the area if it is a 10 second walk away or less. Managed to use webWalking instead, and it seems to work much better Ah great! So you have some experience with Java through university. That'll definitely help in shallowing the learning curve. Regarding webwalking, as I said, this system is---by nature---much less reliable than a hard-coded sequence of positions which constitute a path. So, if the route you're walking is regular and known, i'd strongly recommend recording a path (there are tools for this on the SDN, or local section I believe. Or, make your own!). Then, you can use the walkPath method which will be more reliable and resource-efficient. GL! Apa Quote Link to comment Share on other sites More sharing options...