ProFlax - version 1.2
Bugs:
Sometimes freezes while walking.. no idea why, might just be an issue for me. If it happens, pause and resume the script and it will continue Fixed in 1.1(cheapfix)
Walking is not perfect, it will sometimes click too close to the law courts area but will fix itself. Fixed in 1.1
DL: http://up.ht/YbXiZr
Update List:
1.2: April 08, 2013 * Fix for banking1.1: April 06, 2013 * Fix for right-clicking and trading/reporting while picking flax * Fixed the freezing bug while walking + walking onto courthouse area * Upgraded paint to be more visually appealing 1.0: April 06, 2013 * Initial Release
import org.osbot.script.mouse.MouseDestinationimport org.osbot.script.rs2.map.Positionimport org.osbot.script.rs2.model.NPC import java.awt.Colorimport java.awt.Fontimport java.awt.Graphicsimport org.osbot.script.ScriptManifestimport org.osbot.script.Script @ScriptManifest(name = "ProFlax", author = "Danny", version = 1.2D, info = "Start anywhere near the bank/flax field with no items in your inventory.") class ProFlax extends Script { enum State { BANKING, WALK_TO_FIELD, WALK_TO_BANK, PICK_FLAX; } def state def flaxBanked = 0, startTime = 0 def runTime = "" def hourlyFlax = "0" def bankTile = new Position(2726, 3492, 0) def flaxTile4 = new Position(2737, 3443, 0) def flaxTile1 = new Position(2727, 3482, 0) def flaxTile2 = new Position(2724, 3469, 0) def flaxTile3 = new Position(2730, 3455, 0) def intermediateTile = new Position(2732, 3450, 0) void onPaint(Graphics g) { dataUpdate() g.setColor(Color.ORANGE) g.drawString("Runtime: " + runTime, 10, 66) g.drawString("Flax banked: " + flaxBanked, 10, 76) g.drawString("Flax / hour: " + hourlyFlax, 10, 86) g.drawString("State: " + state, 10, 96) g.drawString("ProFlax V1.2", 10, 50) g.drawLine(8, 52, 79, 52) } public void dataUpdate() { long seconds = 0, minutes = 0, hours = 0, time = System.currentTimeMillis() - startTime; seconds = time / 1000; if (seconds >= 60) { minutes = seconds / 60; seconds -= (minutes * 60); } if (minutes >= 60) { hours = minutes / 60; minutes -= (hours * 60); } runTime = "" + hours + ":" + minutes + ":" + seconds; if (flaxBanked > 0) { double fph = (int) ((flaxBanked) * 3600000D / (System.currentTimeMillis() - startTime)); hourlyFlax = ""+fph } } void onExit() { log("ProFlax finished") } void onStart() { log("ProFlax initializing...") state = State.WALK_TO_FIELD startTime = System.currentTimeMillis(); } int onLoop() { switch (state) { case State.BANKING: if (client.bank.isOpen()) { if (client.inventory.isFull()) { def i = 0 flaxBanked = flaxBanked + 28 while (!client.getInventory().isEmpty() && i < client.getInventory().getItems().length) { def item = client.getInventory().getItems()[i] if (item == null) { i = client.getInventory().getFirstEmptySlot(i) continue } selectInventoryOption(i++, client.getInventory().getAmount(item) > 1 ? "Store all" : "Store 1") sleep(300) } if (!client.inventory.isFull()) { walk(new Position(2728, 3482, 0)) sleep(1000) state = State.WALK_TO_FIELD; } } } else { def booth = closestObject(25808) if (booth != null) { client.moveCameraToEntity(booth) sleep(1200); selectEntityOption(booth, "Bank") sleep(800); } } break; case State.WALK_TO_FIELD: while(myY() > flaxTile1.getY() + 3) { walk(flaxTile1) bot.pauseCurrentScript() bot.resumeCurrentScript() sleep(1800) } while(myY() > flaxTile2.getY() + 3) { walk(flaxTile2) bot.pauseCurrentScript() bot.resumeCurrentScript() sleep(1800) } while(myY() > flaxTile3.getY() + 3) { walk(flaxTile3) bot.pauseCurrentScript() bot.resumeCurrentScript() sleep(1800) } while(myY() > flaxTile4.getY() + 3) { walk(flaxTile4) bot.pauseCurrentScript() bot.resumeCurrentScript() sleep(1800) } def flax = closestObject(3634) if (flax != null) { if (distance(flax) <= 5) { state = State.PICK_FLAX; } } sleep(800); break; case State.WALK_TO_BANK: while(myY() < bankTile.getY() - 4) { walk(bankTile) bot.pauseCurrentScript() bot.resumeCurrentScript() sleep(1800) } def booth = closestObject(25808) if (booth != null) { if(distance(booth) < 8) { state = State.BANKING; } } sleep(600); break; case State.PICK_FLAX: def flax = closestObject(3634) if (flax != null) { selectOption(flax, flax.getMouseDestination(), "Pick", true) sleep(300); if (client.inventory.isFull()) { walk(intermediateTile) sleep(1200) state = State.WALK_TO_BANK; } } break; } return random(50, 150); }}