regnivon Posted August 20, 2016 Posted August 20, 2016 This is my first real script after doing a few basic ones. I am trying to make a script that collects and deposits planks from the barb outpost. It is currently trying to collect planks even when the inventory is full. It also seems to not want to open the bank. If you have solutions to these issues or notice any others please let me know! Thanks you. My code: package planks;import org.osbot.rs07.api.map.Area;import org.osbot.rs07.api.model.Entity;import org.osbot.rs07.api.model.GroundItem;import org.osbot.rs07.script.Script;import org.osbot.rs07.script.ScriptManifest;import org.osbot.rs07.utility.ConditionalSleep;import java.awt.*;@ScriptManifest(name = "Planks", author = "regnivon", version = 1.0, info = "", logo = "")public class Main extends Script { Area PlankArea = new Area(2549, 3579, 2556, 3574); Area BankArea = new Area(2531, 3576, 2536, 3570); private long startTime = System.currentTimeMillis(); @@Override public void onStart() { log("hi"); } @@Override public void onExit() { log("bye"); } @@Override public int onLoop() { Entity player = myPlayer(); GroundItem plank = groundItems.closest("Plank"); if (inventory.isFull() && !BankArea.contains(player)) { getWalking().webWalk(BankArea); } if (inventory.isFull() && BankArea.contains(player)) { if (getBank().isOpen()) { getBank().depositAll(); new ConditionalSleep(3000,5000) { @@Override public boolean condition() throws InterruptedException { return (!inventory.isFull()); } }.sleep(); } else { Entity box = objects.closest("Bank chest"); if (box != null) { box.interact("Use"); } } }if (inventory.isEmpty() && !PlankArea.contains(player)) { getWalking().webWalk(PlankArea); } if (plank != null && !inventory.isFull()) { plank.interact("Take"); return 500; } return 500; } @@Override public void onPaint(Graphics2D g2d) { super.onPaint(g2d); g2d.drawString("Elapsed seconds: " + (int) ((System.currentTimeMillis() - startTime) / 1000), 20, 265); }}
Explv Posted August 21, 2016 Posted August 21, 2016 This is my first real script after doing a few basic ones. I am trying to make a script that collects and deposits planks from the barb outpost. It is currently trying to collect planks even when the inventory is full. It also seems to not want to open the bank. If you have solutions to these issues or notice any others please let me know! Thanks you. My code: Well isn't it a deposit box not a bank at the barbarian outpost?
Keven Posted August 21, 2016 Posted August 21, 2016 Well isn't it a deposit box not a bank at the barbarian outpost? I think they updated it to a bank (chest). 1
Precise Posted August 21, 2016 Posted August 21, 2016 I think they updated it to a bank (chest). Yes it is
Explv Posted August 21, 2016 Posted August 21, 2016 (edited) I think they updated it to a bank (chest). I c, @op have you tried using getBank().open() ? Edited August 21, 2016 by Explv
regnivon Posted August 21, 2016 Author Posted August 21, 2016 I managed to get it working! I think it might have been a problem with the inventory check, but Im not actually sure because i changed a few things and it started working. Thank you for the help though!