Chambo Posted February 27, 2016 Share Posted February 27, 2016 So it buys the Feather packs just fine but when it begins opening the packs it freezes the client. Any suggestions? import java.awt.*; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Chambo", info = "A simple Feather pack buyer!", name = "Chambo's Feather Buyer", version = 0.3, logo = "") public class Main extends Script { private enum State { BUY, OPEN }; private State getState() { if (inventory.isFull()){ return State.OPEN; }else{ return State.BUY; } } @Override public void onStart() { log("Script successfully started!"); } @Override public int onLoop() throws InterruptedException { switch (getState()) { case BUY: if (getInventory().getAmount("Coins") >= 300 ){ NPC shop = npcs.closest("Gerrant"); if (shop != null && shop.isVisible()) { shop.interact("Trade"); sleep(random(500, 600)); if (!inventory.isFull()){ store.buy("Feather pack", 20); sleep(random(500, 600)); store.buy("Feather pack", 20); sleep(random(500, 600)); store.close(); } } }else{ log("Not enough coins! Stopping Script!"); stop(); } break; case OPEN: if (getInventory().contains("Feather pack")){ inventory.interact("Feather pack", "Open"); sleep(random(400, 100)); } break; } return random(200, 300); } @Override public void onExit() { log("Thanks for using Chambo's Feather Buyer!"); } @Override public void onPaint(Graphics2D g) { } } Quote Link to comment Share on other sites More sharing options...
itzDot Posted February 27, 2016 Share Posted February 27, 2016 U need to null check, coins I think Quote Link to comment Share on other sites More sharing options...
Krulvis Posted February 27, 2016 Share Posted February 27, 2016 Check if store is open Quote Link to comment Share on other sites More sharing options...
Zappster Posted February 27, 2016 Share Posted February 27, 2016 U need to null check, coins I think Shouldn't be the issue at all. Can we get the error log output please? Quote Link to comment Share on other sites More sharing options...
Chambo Posted February 27, 2016 Author Share Posted February 27, 2016 Shouldn't be the issue at all. Can we get the error log output please? I would but the client crashes and i cant get the log Quote Link to comment Share on other sites More sharing options...
Zappster Posted February 27, 2016 Share Posted February 27, 2016 I would but the client crashes and i cant get the log Open the logger before you start your script... 1 Quote Link to comment Share on other sites More sharing options...
iJodix Posted February 27, 2016 Share Posted February 27, 2016 You might want to do a check if the store is actually open as i'm pretty sure the sleep amount after you have interacted with npc isn't enough. Quote Link to comment Share on other sites More sharing options...
Krulvis Posted February 27, 2016 Share Posted February 27, 2016 Check if store is open You might want to do a check if the store is actually open as i'm pretty sure the sleep amount after you have interacted with npc isn't enough. Yes, this is obviously the problem Quote Link to comment Share on other sites More sharing options...
iJodix Posted February 27, 2016 Share Posted February 27, 2016 Yes, this is obviously the problem Very obvious Quote Link to comment Share on other sites More sharing options...