February 27, 20169 yr 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) { } }
February 27, 20169 yr U need to null check, coins I think Shouldn't be the issue at all. Can we get the error log output please?
February 27, 20169 yr Author 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
February 27, 20169 yr I would but the client crashes and i cant get the log Open the logger before you start your script...
February 27, 20169 yr 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.
February 27, 20169 yr 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
Create an account or sign in to comment