Zor Posted August 8, 2018 Share Posted August 8, 2018 (edited) Zzz Woodcutter Status:Working Download: V1.1 Code:Github Simple working script to chop logs from 1-15 then Oak logs until ban 1-15 logs 15-ban oak logs Start with 7 questpoints Deposits oak logs at port sarim Muling support at set amount of logs Desktop notifications when it is ready to mule Very informative paint Muling at Draynor bank Future features? Known bugs can only use bronze axe Guidelines: Start anywhere, Equip axe (not mandatory but helpful, has to at least be in inventory) Expect a ban Can be started at whatever Woodcutting level Notes: I would like to thank @Rays for helping me by showing me snippets to help with this and for the idea I created this script in 24 hours if there are any bugs please report them Edited August 8, 2018 by Zor 1 1 Quote Link to comment Share on other sites More sharing options...
dreameo Posted August 8, 2018 Share Posted August 8, 2018 Hi, I didn't fully look at your code but I see so many people doing this recently so I had to say something (bad open source code hurts the community because bad practices are being learned, not saying your code is bad or anything, just in general). 'This' keyword is used mainly for ambiguity. Example: public Class Test(){ private String name; public Test(String name){ this.name = name; } } People lately have been doing 'this.add()' where add() is a function that exists in the class that you're writing in. Don't do this. 2 Quote Link to comment Share on other sites More sharing options...
Zor Posted August 8, 2018 Author Share Posted August 8, 2018 (edited) 48 minutes ago, dreameo said: Hi, I didn't fully look at your code but I see so many people doing this recently so I had to say something (bad open source code hurts the community because bad practices are being learned, not saying your code is bad or anything, just in general). 'This' keyword is used mainly for ambiguity. Example: public Class Test(){ private String name; public Test(String name){ this.name = name; } } People lately have been doing 'this.add()' where add() is a function that exists in the class that you're writing in. Don't do this. tbh anything with "this" in it was a copy and paste i did a lot of copy and paste for this and then fixing it but ill remove it to help out the community i dont really see how it hurts it though Edit:Removed this as much as i could Edited August 8, 2018 by Zor 1 Quote Link to comment Share on other sites More sharing options...
Rays Posted August 8, 2018 Share Posted August 8, 2018 Gratz on release! 1 Quote Link to comment Share on other sites More sharing options...
yfoo Posted August 15, 2018 Share Posted August 15, 2018 I would recommend splitting the project into multiple files. It is not easy to read the code when everything is thrown in to 1 file. If you are unsure about using multiple files, then organize your code such that similar methods are close to each other IMO I would put in this order onStart() onLoop() onExit() onPaint() onMessage() These 5 methods are inherited from Script, and are similar in that sense. bank() mule() and waitForTrade() These 3 are helper methods as they "help" do things in onLoop afk() only sleeps for a bit, why not just replace every afk() call with whatever you had. sleep(random(3000, 8000)) or whatever. Furthermore this line in onMessage() does not discern between different message types, if a player spams "You get some oak logs" then your oak log cut counter gets incremented. if(m.getMessage().contains("You get some oak logs")) oaklogscut++; first check the message type, you only care if it is a game message. See: https://osbot.org/api/org/osbot/rs07/api/ui/Message.html if(m.getType == Message.MessageType.GAME && m.getMessage().contains("You get some oak logs") oaklogscut++; Also, what does this do? the timegui variable is never used. You don't need to use a separate thread to track time, do this in onPaint() which already runs on its own thread. I think you already do this, so this snippet does nothing. thread = new Thread(){ @Override public synchronized void run() { while (Main.this.isRunning) { try { timegui = System.currentTimeMillis() - Main.this.startTime; this.wait(50); } catch (InterruptedException ex) { Main.this.log((Object)ex); } } } }; thread.start(); Finally why is the code indented weirdly. If you are using an ide you can auto-formate the code. Anyway, good job. Quote Link to comment Share on other sites More sharing options...
Rays Posted August 20, 2018 Share Posted August 20, 2018 (edited) On 8/15/2018 at 3:08 AM, PayPalMeRSGP said: Also, what does this do? the timegui variable is never used. You don't need to use a separate thread to track time, do this in onPaint() which already runs on its own thread. I think you already do this, so this snippet does nothing. thread = new Thread(){ @Override public synchronized void run() { while (Main.this.isRunning) { try { timegui = System.currentTimeMillis() - Main.this.startTime; this.wait(50); } catch (InterruptedException ex) { Main.this.log((Object)ex); } } } }; thread.start(); Finally why is the code indented weirdly. If you are using an ide you can auto-formate the code. Anyway, good job. This is probably due to him picking up some things from my source-code; I actually did not know that onPaint() already runs on its own thread. Also, the "this" keyword which is a bad habit I adapted when first starting out. Edited August 20, 2018 by Rays Quote Link to comment Share on other sites More sharing options...