Isolate Posted March 31, 2015 Share Posted March 31, 2015 (edited) Saw a post by @faintdrugs and decided to make something because I had a moment. Don't know if anything's wrong with it, if anyone sees a mistake feel free to call me out. Some Example Code: import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.map.PolygonArea; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; /** * Created by ~Anon on 31/03/2015. */ @ScriptManifest(author = "~Anon", name = "Ash Picker", version = 0.1, info = "Picks Up And Banks Ashes!", logo = "") public class Ashes extends Script{ final PolygonArea ZONE = new PolygonArea(/*tiles boardering area*/); String lastLoggedStatus = " "; String Status = " "; private enum States{ PICK, BANK; } @Override public void onStart() throws InterruptedException { log("Welcome To "+getAuthor()+"'s Ash Picker!"); if(!ZONE.contains(myPlayer())){ log("Please Start in ZONE!"); stop(false); } } @Override public int onLoop() throws InterruptedException { printStatus(); switch (getState()){ case BANK: Status = "Banking."; doBanking(); break; case PICK: Status = "Picking."; doPicking(); break; } return random(250, 500); } private States getState(){ if(inventory.isFull()){ return States.BANK; }else{ return States.PICK; } } private void doBanking() throws InterruptedException { if(!bank.isOpen()){ Status = "Banking: Opening Bank."; NPC banker = npcs.closest("Banker"); if(banker != null) { if (banker.isOnScreen()) { Status = "Banking: Interacting Banker."; banker.interact("Bank"); sleep(random(500, 900)); } else { Status = "Banking: Locating Banker."; if (banker.getPosition().distance(myPosition()) > 6) { localWalker.walk(banker); } else { camera.toEntity(banker); } } } }else{ Status = "Banking: Depositing."; bank.depositAll(); sleep(random(250, 450)); } } private void doPicking() throws InterruptedException { if(bank.isOpen()){ Status = "Picking: Closing Bank."; bank.close(); }else{ GroundItem ashes = groundItems.closest(new Filter<GroundItem>() { @Override public boolean match(GroundItem groundItem) { return groundItem != null && groundItem.getName().equals("Ashes") && ZONE.contains(groundItem); } }); if(ashes != null){ if(ashes.isOnScreen()){ Status = "Picking: Picking Up Ashes."; ashes.interact("Take"); sleep(random(500, 900)); }else{ Status = "Picking: Locating Ashes."; if(ashes.getPosition().distance(myPosition())> 6){ localWalker.walk(ashes); }else{ camera.toEntity(ashes); } } } } } private void printStatus(){ if(lastLoggedStatus != Status){ log("Current Status: " + Status); lastLoggedStatus = Status; } } } Note: I'm used to coding everything in the main loop and did my best to convert the code to a more manageable style for newer people Edited May 4, 2015 by Isolate 1 Quote Link to comment Share on other sites More sharing options...
Fade Posted March 31, 2015 Share Posted March 31, 2015 Looking at someone's source code is always helpful for new scriptwriters Quote Link to comment Share on other sites More sharing options...
Twin Posted March 31, 2015 Share Posted March 31, 2015 Damn you went hard with this the basic one I wrote him was like 2 lines of code Quote Link to comment Share on other sites More sharing options...
Celeos Posted March 31, 2015 Share Posted March 31, 2015 Everything seems fine although what's with the messy formatting? Quote Link to comment Share on other sites More sharing options...
Twin Posted March 31, 2015 Share Posted March 31, 2015 Everything seems fine although what's with the messy formatting? Okay i have to ask, where is your signature from? Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 31, 2015 Author Share Posted March 31, 2015 Damn you went hard with this the basic one I wrote him was like 2 lines of code Safe* Everything seems fine although what's with the messy formatting? I'm a messy guy 1 Quote Link to comment Share on other sites More sharing options...
bzmake Posted April 18, 2015 Share Posted April 18, 2015 Hey, could u help me out with my script? Much appreciated! Quote Link to comment Share on other sites More sharing options...
Isolate Posted April 18, 2015 Author Share Posted April 18, 2015 Hey, could u help me out with my script? Much appreciated! Of Course! Sorry I had to rush off and do something. Did you want to add my skype 'isolatepb' or message me on the forums? Quote Link to comment Share on other sites More sharing options...
MoronicMan Posted May 4, 2015 Share Posted May 4, 2015 OP, sees* Quote Link to comment Share on other sites More sharing options...