IcCookies 24 Posted October 23, 2015 Hello, This is my first script, and somehow I can't get it to work. So basically this script fishes in Draynor and is supposed to bank, but when my inventory is full, it just walk over to the bank and does nothing. Any help would be appreciated! Source code: package bots; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.map.Area; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.interactive.NPC; import java.awt.*; @ScriptManifest(category = Category.FISHING, name = "IcCookies' DraynorFisher", author = "IcCookies", version = 1.0) public class DraynorFisher extends AbstractScript { @Override public void onStart() { log("Welcome to IcCookies' private script!"); } Area fishArea = new Area(3085, 3233, 3089, 3224, 0); Area bankArea = new Area(3092, 3245, 3095, 3240, 0); @Override public int onLoop() { if (!getInventory().isFull()) { if (fishArea.contains(getLocalPlayer())) { NPC Fishing_spot = getNpcs().closest( npc -> npc != null && npc.hasAction("Net")); if (Fishing_spot != null && Fishing_spot.interact("Net")) { sleep(Calculations.random(15000, 30000)); } } else { if (getWalking().walk(fishArea.getRandomTile())) { sleep(Calculations.random(3000, 5500)); } } if (getInventory().isFull()) { if (bankArea.contains(getLocalPlayer())) { NPC Banker = getNpcs().closest( npc -> npc != null && npc.hasAction("Bank")); if (Banker != null && Banker.interact("Bank")) { if (sleepUntil(() -> getBank().isOpen(), 5000)) { if (getBank().depositAllExcept( item -> item != null && item.getName().contains("net"))) { if (sleepUntil(() -> !getInventory().isFull(), 5000)) { if (getBank().close()) { sleepUntil(() -> !getBank().isOpen(), 5000); } } } } } } else { if (getWalking().walk(bankArea.getRandomTile())) { sleep(Calculations.random(3000, 5500)); } } } } return 600; } @Override public void onExit() { log("Thank you for using this script."); } @Override public void onPaint(Graphics graphics) { } }
RealEngine 24 Posted October 23, 2015 next time you post wrap your code in the <> brackets at the top of the text editor like this have you tried using getBank().open()
IcCookies 24 Author Posted October 23, 2015 next time you post wrap your code in the <> brackets at the top of the text editor like this have you tried using getBank().open() Hmm. So instead of Banker.interact("Bank") i would use that? That's very intesting.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.