Jump to content

MadMork

Members
  • Posts

    4
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

MadMork's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. So what you're saying is the code needs to perform a click on the inventory (open the inventory) before it can determine which items are in the inventory?
  2. Lol, you kidding me? Was a pain in the ass to write the door method, but thanks! You think you can help me out with the hopping? Should I just declare an int variable and increase it every hop, if it reaches x then go bank?
  3. First of all, first ever script I'm writing so don't judge me (yet). So the problem here is everytime the bot hops to a random F2P world, and the onLoop method runs, it returns the currentState.INVENTORY_FULL --- EVEN WHEN THE INVENTORY IS NOT FULL! I've tried numerous things, conditional loop till player exists, player is visible, player is not null, player is on screen but it always returns true when checking if the inventory is full. Here is my source code: import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.utility.ConditionalSleep; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Stufid N00b", info = "Zaff's Staff Hoarder", name = "ZaffBot BETA", version = 0, logo = "") public class Main extends Script { public NPC zaffNPC; public Position zaffShopPos; public boolean coinsAreAvailable = false; public boolean reachedZaffShopPos = false; public boolean zaffDoorOpen = false; public boolean playerAtZaff = false; public enum currentState { NULL, COINS_AVAILABLE, REACHED_ZAFF_SHOP, ZAFF_DOOR_OPEN, INVENTORY_FULL } public currentState getState() { if (!coinsAreAvailable) { if (getInventory().contains("Coins")) { coinsAreAvailable = true; log("Coins are available."); return currentState.COINS_AVAILABLE; } else { log("Coins are not available, stopping script."); stop(false); } } if (reachedZaffShopPos) { return currentState.REACHED_ZAFF_SHOP; } if (zaffDoorOpen) { RS2Object zaffDoor = getObjects().closest("Door"); if (zaffDoor != null && zaffDoor.hasAction("Close")) { zaffDoorOpen = false; return currentState.ZAFF_DOOR_OPEN; } else { zaffDoorOpen = false; reachedZaffShopPos = true; } } if (playerAtZaff) { playerAtZaff = false; return currentState.ZAFF_DOOR_OPEN; } if (getInventory().isFull()) { log("Inventory is full."); return currentState.INVENTORY_FULL; } return currentState.NULL; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case COINS_AVAILABLE: zaffShopPos = new Position(3205,3432,0); log("Attempting to walk to zaffShopPos."); if (getWalking().webWalk(zaffShopPos)) { reachedZaffShopPos = true; } else { coinsAreAvailable = false; //Restart script } case REACHED_ZAFF_SHOP: RS2Object zaffDoor = getObjects().closest("Door"); if (zaffDoor != null && zaffDoor.hasAction("Open")) { if (zaffDoor.interact("Open")) { reachedZaffShopPos = false; zaffDoorOpen = true; log("Zaff's door is now open."); } } else if (zaffDoor != null && zaffDoor.hasAction("Close")) { reachedZaffShopPos = false; zaffDoorOpen = true; log("Zaff's door is open."); } case ZAFF_DOOR_OPEN: new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { zaffNPC = getNpcs().closest("Zaff"); return (zaffNPC != null && zaffNPC.isVisible()); } }.sleep(); zaffNPC = getNpcs().closest("Zaff"); if (zaffNPC != null && zaffNPC.isVisible()) { camera.toEntity(zaffNPC); if (zaffNPC.interact("Trade")) { int rndSleepTime1 = random(3000,5000); Thread.sleep(rndSleepTime1); if (getStore() != null && getStore().isOpen()) { if (getStore().getAmount("Staff") > 0) { if (getStore().buy("Staff", 5)) { int rndSleepTime2 = random(1000,5000); Thread.sleep(rndSleepTime2); getStore().close(); if (getWorlds().hopToF2PWorld()) { new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { zaffNPC = getNpcs().closest("Zaff"); return (zaffNPC != null && zaffNPC.isVisible()); } }.sleep(); playerAtZaff = true; } } } } else { reachedZaffShopPos = true; } } } case INVENTORY_FULL: if (!(Banks.VARROCK_WEST.contains(myPlayer().getPosition()))) { log("Inventory is full..?!"); getWalking().webWalk(Banks.VARROCK_WEST); } else { if (!(getBank().isOpen())) { getBank().open(); new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); log("Attempting to deposit items..."); if (getBank().depositAllExcept("Coins")) { new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return !getInventory().isFull(); } }.sleep(); coinsAreAvailable = false; } } } } return random(500,1000); } } I'd like some help.
×
×
  • Create New...