thatguycalledrob Posted September 25, 2017 Share Posted September 25, 2017 (edited) I'm trying to improve at Java & RS script design. I am making a (fully) open source quester for F2P - please have a look and leave suggestions & feedback. Bugs / coding cleanliness /Constructive feedback - all are welcome. https://github.com/thatguycalledrob/Quester-FREE Ultimately my goal is for this to complete all F2P quests (maybe minus dragon slayer) & provide stealth training for the levels required. This is aimed to progress my own ability in scripting for OSbot, as well as a useful script for others. COMPLETES: Sheep Shearer Romeo & Juliet Cook's Assistant Rune Mysteries The Restless Ghost IN DEVELOPMENT: Goblin Diplomacy Doric's Quest (in progress) (+ option to "make the money" to buy the items) (+ fishing & cooking the food for this) DEVELOPMENT PENDING: Nice GUI for quest order selection & the like. A simple paint. CREDIT EXPLV for his great tutorial, map tool, Conditional sleep snippets & Open source tutorial island script. Spoiler Dark Magician for his easy Entity manipulation code! Spoiler I'm sure there will be more soon ~ Rob Edited October 17, 2017 by thatguycalledrob 2 Quote Link to comment Share on other sites More sharing options...
thatguycalledrob Posted September 25, 2017 Author Share Posted September 25, 2017 R&J should be easy now I have the structure worked out Quote Link to comment Share on other sites More sharing options...
A one Posted September 25, 2017 Share Posted September 25, 2017 nice gl on the script Quote Link to comment Share on other sites More sharing options...
Fegit Posted September 25, 2017 Share Posted September 25, 2017 Seems nice, havent tried it though. Have fun scripting Quote Link to comment Share on other sites More sharing options...
TheWind Posted September 25, 2017 Share Posted September 25, 2017 Looks really good so far. The only class that seems a little strange to me is your EasyEntManipulator. I guess its pretty useful for debugging, but a lot of the methods look like they make the same checks multiple times. Other than that I wish you luck in finishing the project! Quote Link to comment Share on other sites More sharing options...
thatguycalledrob Posted September 25, 2017 Author Share Posted September 25, 2017 23 minutes ago, TheWind said: Looks really good so far. The only class that seems a little strange to me is your EasyEntManipulator. I guess its pretty useful for debugging, but a lot of the methods look like they make the same checks multiple times. Other than that I wish you luck in finishing the project! Yeah its a modified version of dark magician's - I will clean them up a little before I fully release this script, but as you say, they are amazing for debugging right now! Quote Link to comment Share on other sites More sharing options...
Colonel_Panic Posted September 25, 2017 Share Posted September 25, 2017 Nice work man! I haven't looked through it fully as I need to get back to work, but here's some things I noticed in my quick look through (Keep in mind these are coming more from experience as a general developer, not specifically for OSBot script writing as I'm new to that just like you): Your sleeps are a bit hard to follow. How come you switch around your sleep times so drastically and switch between calling it in the main loop and calling it in child functions (e.g. you call sleep from within ConverseWithFred, but don't call it in the main loop) As TheWind said, EasyEntManipulator is messy; but I can see why you're using it currently. You could add a boolean (called something like VERBOSE, which is the standard name used for clarifying if you want to log extra debug messages or not) and then wrap your debug logs in a block with "if (VERBOSE)". That way you can quickly turn off all the extra debug code (by setting VERBOSE = false), and it makes it clear for anyone else reading your code that anything inside VERBOSE blocks is simply for debugging purposes. Quote Link to comment Share on other sites More sharing options...
thatguycalledrob Posted September 25, 2017 Author Share Posted September 25, 2017 Thanks for the feedback! I will give what feedback I can in return if you upload any code. 20 minutes ago, Colonel_Panic said: Your sleeps are a bit hard to follow. How come you switch around your sleep times so drastically and switch between calling it in the main loop and calling it in child functions (e.g. you call sleep from within ConverseWithFred, but don't call it in the main loop) 2 Yeah, my sleep's are totally messed up - definitely one for the next version! I started developing with Explv's conditional sleep classes (which I base on the maximum expected execution time of the activity), but then I hit a null pointer exception earlier in development, which hung my game window since it looped endlessly with no delay between loops (as to let me hit the big red button). I started adding sleeps all over the place to mitigate this, as well as trying to be clever and implement a normally distributed sleeping as a form of an anti-pattern, but my implementation of the whole thing is all over the place. 29 minutes ago, Colonel_Panic said: As TheWind said, EasyEntManipulator is messy; but I can see why you're using it currently. You could add a boolean (called something like VERBOSE, which is the standard name used for clarifying if you want to log extra debug messages or not) and then wrap your debug logs in a block with "if (VERBOSE)". That way you can quickly turn off all the extra debug code (by setting VERBOSE = false), and it makes it clear for anyone else reading your code that anything inside VERBOSE blocks is simply for debugging purposes. Ah, great suggestion - and I was here thinking that I would just comment them all out when the time comes! will implement now Quote Link to comment Share on other sites More sharing options...
Colonel_Panic Posted September 25, 2017 Share Posted September 25, 2017 (edited) 30 minutes ago, thatguycalledrob said: Thanks for the feedback! I will give what feedback I can in return if you upload any code. Yeah, my sleep's are totally messed up - definitely one for the next version! I started developing with Explv's conditional sleep classes (which I base on the maximum expected execution time of the activity), but then I hit a null pointer exception earlier in development, which hung my game window since it looped endlessly with no delay between loops (as to let me hit the big red button). I started adding sleeps all over the place to mitigate this, as well as trying to be clever and implement a normally distributed sleeping as a form of an anti-pattern, but my implementation of the whole thing is all over the place. Ah, great suggestion - and I was here thinking that I would just comment them all out when the time comes! will implement now If you want to really up your game, you could add CLI support for parameters (check out this guide: ) And then you could pass in true or false as a parameter when you run the script. I'd recommend having it default to false so if you run it without parameters, it'll still work and just not log by default. Something like this should do the trick: // inside yourEasyEntManipulator: public static boolean VERBOSE = false; // default debugging to off // put this inside your onStart method: if (getParameters() != null) { String[] params = getParameters().split(","); //split parameters around commas EasyEntManiupulator.VERBOSE=Boolean.parseBoolean(params[0]); } Then if you want to run it with debug you can quickly do so with: java -jar OSBot.jar -login osbotname:osbotpass -bot "Novice Quester":true instead of having to change VERBOSE in eclipse and export it as a new jar every time you want to turn logging on or off Edited September 25, 2017 by Colonel_Panic 1 Quote Link to comment Share on other sites More sharing options...
thatguycalledrob Posted September 25, 2017 Author Share Posted September 25, 2017 6 hours ago, Colonel_Panic said: If you want to really up your game, you could add CLI support for parameters (check out this guide: ) And then you could pass in true or false as a parameter when you run the script. I'd recommend having it default to false so if you run it without parameters, it'll still work and just not log by default. Something like this should do the trick: // inside yourEasyEntManipulator: public static boolean VERBOSE = false; // default debugging to off // put this inside your onStart method: if (getParameters() != null) { String[] params = getParameters().split(","); //split parameters around commas EasyEntManiupulator.VERBOSE=Boolean.parseBoolean(params[0]); } Then if you want to run it with debug you can quickly do so with: java -jar OSBot.jar -login osbotname:osbotpass -bot "Novice Quester":true instead of having to change VERBOSE in eclipse and export it as a new jar every time you want to turn logging on or off Modified it to work with your VERBOSE suggestion, will implement CLI further down the road, although its a great suggestion for the "production" finish! Also the new version includes R&J quest Quote Link to comment Share on other sites More sharing options...
progamerz Posted September 26, 2017 Share Posted September 26, 2017 On 9/25/2017 at 8:18 PM, Colonel_Panic said: If you want to really up your game, you could add CLI support for parameters (check out this guide: ) And then you could pass in true or false as a parameter when you run the script. I'd recommend having it default to false so if you run it without parameters, it'll still work and just not log by default. Something like this should do the trick: // inside yourEasyEntManipulator: public static boolean VERBOSE = false; // default debugging to off // put this inside your onStart method: if (getParameters() != null) { String[] params = getParameters().split(","); //split parameters around commas EasyEntManiupulator.VERBOSE=Boolean.parseBoolean(params[0]); } Then if you want to run it with debug you can quickly do so with: java -jar OSBot.jar -login osbotname:osbotpass -bot "Novice Quester":true instead of having to change VERBOSE in eclipse and export it as a new jar every time you want to turn logging on or off I don't think you will be able to split with "," cause osbot uses that, instead u can use ";" Quote Link to comment Share on other sites More sharing options...
TiPPeX Posted September 30, 2017 Share Posted September 30, 2017 Great progress and great tips! Following and will be using this! Thanks! Quote Link to comment Share on other sites More sharing options...
flexike Posted October 3, 2017 Share Posted October 3, 2017 Just tried it, and I don't think it works properly. I started the script in Lumby castle, and first I thought it works flawless when it started to webwalk towards Fred, but when it reaches Fred's house, and as soon as it walks into the house, the script just goes #phase2 and start walking to Juliet's house. I'm gonna copy the OSBot logger: [INFO][Bot #1][10/03 02:55:11 DU]: Started script : Novice Quester [INFO][Bot #1][10/03 02:55:11 DU]: In sheep quest [INFO][Bot #1][10/03 02:55:11 DU]: Case 0 selected [INFO][Bot #1][10/03 02:55:11 DU]: Trying to Begin Quest [INFO][Bot #1][10/03 02:55:12 DU]: Walking to Freds House [INFO][Bot #1][10/03 02:55:46 DU]: WebWalkingEvent; We have reached the final destination! [INFO][Bot #1][10/03 02:55:47 DU]: In R&J quest [INFO][Bot #1][10/03 02:55:47 DU]: Case 0 selected [INFO][Bot #1][10/03 02:55:47 DU]: Walking to Juliet [INFO][Bot #1][10/03 02:57:59 DU]: WebWalkingEvent; We have reached the final destination! [INFO][Bot #1][10/03 02:57:59 DU]: In sheep quest [INFO][Bot #1][10/03 02:57:59 DU]: Case 0 selected [INFO][Bot #1][10/03 02:57:59 DU]: Trying to Begin Quest [INFO][Bot #1][10/03 02:58:00 DU]: Walking to Freds House Quote Link to comment Share on other sites More sharing options...
Antonio Kala Posted October 3, 2017 Share Posted October 3, 2017 Cool will be a great contribution, keep us updated Quote Link to comment Share on other sites More sharing options...
thatguycalledrob Posted October 9, 2017 Author Share Posted October 9, 2017 On 10/3/2017 at 2:02 PM, flexike said: Just tried it, and I don't think it works properly. I started the script in Lumby castle, and first I thought it works flawless when it started to webwalk towards Fred, but when it reaches Fred's house, and as soon as it walks into the house, the script just goes #phase2 and start walking to Juliet's house. I'm gonna copy the OSBot logger: 2 Just picking this up again now I am moved into my new place for the year. Classic Java noob mistake, I forgot to break; my case in my switch statement. Of all the things to go wrong! I submitted a fix just now, and am hoping to add the next quest tonight or tomorrow! Quote Link to comment Share on other sites More sharing options...