Pandemic Posted January 2, 2014 Author Share Posted January 2, 2014 You make a good point, but say I wanted to perfect the walking system. Can I implement an array of coordinates for each point that can randomize where they are going. Example being it would read each new position as if it would a new area, with an x and y coordinate for the top right and the bottom left? And then I could just reduce the size of the square area to maybe 4 spaces so it would choose each new position between the 4 spaces as opposed to clicking 1 single space? private Position[] path = { new Position1 new Position2 new Position3 }; and then have each Position1, Position2, Position3 declared as an Area (x,y,dx,dy) Is that possible? I feel as if that would be a lot less obvious of a script. Personally, I'd find that useless, but you certainly could. I'd just add another method like this: private Position randomizePosition(Position p) return new Position(p.getX() + random(-2, 2), p.getY() + random(-2, 2), p.getZ()); then in the walkTile method just change the position to this ^ Quote Link to comment Share on other sites More sharing options...
Cyro Posted January 2, 2014 Share Posted January 2, 2014 Oh that i, that's just saying if we failed to walk to that tile (took too long or misclicked) to try the same tile again.Yeah ik but what im saying is it doesnt go back to the same tileinstead it will skip the current tile and the next tile as you are decreasing and going forward in your reversed path. That should be an incement operatwr Quote Link to comment Share on other sites More sharing options...
Pandemic Posted January 2, 2014 Author Share Posted January 2, 2014 (edited) Yeah ik but what im saying is it doesnt go back to the same tile instead it will skip the current tile and the next tile as you are decreasing and going forward in your reversed path. That should be an incement operatwr Oh, I see that now , thanks haha. That's why you should never copy and paste similar code :P I'll fix that up. Edited January 2, 2014 by Pandemic Quote Link to comment Share on other sites More sharing options...
ping pong Posted January 2, 2014 Share Posted January 2, 2014 Personally, I'd find that useless, but you certainly could. I'd just add another method like this: private Position randomizePosition(Position p) return new Position(p.getX() + random(-2, 2), p.getY() + random(-2, 2), p.getZ()); then in the walkTile method just change the position to this ^ Ahh that would certainly be more clean than me declaring a new area for every minimap click, especially for longer ranges. Quote Link to comment Share on other sites More sharing options...
Gilgad Posted January 6, 2014 Share Posted January 6, 2014 Wonderful!! Any chance you can make a tutorial on not "How to MAKE a GUI" But how to make it work, as in how to connect the buttons and stuff so you can make an AIO script?cheers Quote Link to comment Share on other sites More sharing options...
Pandemic Posted January 6, 2014 Author Share Posted January 6, 2014 Wonderful!! Any chance you can make a tutorial on not "How to MAKE a GUI" But how to make it work, as in how to connect the buttons and stuff so you can make an AIO script? cheers Sure, it's planned as a future tutorial 2 Quote Link to comment Share on other sites More sharing options...
Kittens Posted January 6, 2014 Share Posted January 6, 2014 Sure, it's planned as a future tutorial Same I really need this as well! Also maybe a tut how to like combine em and stuff like for my GUI I wanna be able to pick my options to pick flax or spin flax into bowstring at lumbridge castle 1 Quote Link to comment Share on other sites More sharing options...
Gilgad Posted January 6, 2014 Share Posted January 6, 2014 Yea. i need to merge my 12 super heaters into 1... trying to figure that out for 5 months. 2 Quote Link to comment Share on other sites More sharing options...
Kittens Posted January 6, 2014 Share Posted January 6, 2014 Yea. i need to merge my 12 super heaters into 1... trying to figure that out for 5 months. yea itd definitely help me and you lol :P you could have it choose superheat bronze bars and help you choose which bars to do any etc :P 1 Quote Link to comment Share on other sites More sharing options...
OSM Posted January 10, 2014 Share Posted January 10, 2014 Thanks very much for this guide, Pandemic. Quote Link to comment Share on other sites More sharing options...
Pandemic Posted January 10, 2014 Author Share Posted January 10, 2014 Thanks very much for this guide, Pandemic. No problem Quote Link to comment Share on other sites More sharing options...
lingoling Posted January 11, 2014 Share Posted January 11, 2014 This is awesome, thank you! Quote Link to comment Share on other sites More sharing options...
Pandemic Posted January 11, 2014 Author Share Posted January 11, 2014 No problem. Quote Link to comment Share on other sites More sharing options...
lolmanden Posted January 11, 2014 Share Posted January 11, 2014 Awesome in-depth guide, thank you. Quote Link to comment Share on other sites More sharing options...
lingoling Posted January 11, 2014 Share Posted January 11, 2014 I'm trying to make my script walk from the mine back to the bank and it's acting weird. I have this for the positions: private Position[] path = { new Position(3289, 3371, 0), new Position(3290, 3374, 0), new Position(3294, 3386, 0), new Position(3290, 3391, 0), new Position(3291, 3401, 0), new Position(3289, 3406, 0), new Position(3286, 3418, 0), new Position(3276, 3426, 0), new Position(3264, 3429, 0), new Position(3254, 3421, 0) }; I manually put them in so I don't know why it's acting odd. Once it gets to the 3rd position it clicks back towards the mine then starts walking South. Any idea what's causing this? Here is my whole script for reference. import java.awt.Graphics; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; import org.osbot.script.mouse.MinimapTileDestination; import org.osbot.script.rs2.map.Position; import org.osbot.script.rs2.model.RS2Object; import org.osbot.script.rs2.utility.Area; @ScriptManifest(author ="Lingoling", info="Mines Tin in Varrock east. Start in bank or at mine.", name = "BasicMiner", version = 0) public class BasicMiner extends Script { private static final int[] TIN_ID = {11636,11634, 11635}; private enum State { MINE, WALK_TO_BANK, BANK, WALK_TO_MINE}; private State getState() { if (client.getInventory().isFull() && MINE_AREA.contains(myPlayer())) return State.WALK_TO_BANK; if (!client.getInventory().isFull() && BANK_AREA.contains(myPlayer())) return State.WALK_TO_MINE; if (client.getInventory().isFull() && BANK_AREA.contains(myPlayer())) return State.BANK; return State.MINE; } private Position[] path = { new Position(3289, 3371, 0), new Position(3290, 3374, 0), new Position(3294, 3386, 0), new Position(3290, 3391, 0), new Position(3291, 3401, 0), new Position(3289, 3406, 0), new Position(3286, 3418, 0), new Position(3276, 3426, 0), new Position(3264, 3429, 0), new Position(3254, 3421, 0) }; private static final Area MINE_AREA = new Area(3277, 3358, 3293, 3371); private static final Area BANK_AREA = new Area(3250, 3419, 3257, 3423); private void traversePath(Position[] path, boolean reversed) throws InterruptedException { if (!reversed) { for (int i = 1; i < path.length; i++) if (!walkTile(path[i])) i--; } else { for (int i = path.length-2; i > 0; i--) if (!walkTile(path[i])) i++; } } private boolean walkTile(Position p) throws InterruptedException { client.moveMouse(new MinimapTileDestination(bot, p), false); sleep(random(150, 250)); client.pressMouse(); int failsafe = 0; while (failsafe < 10 && myPlayer().getPosition().distance(p) > 2) { sleep(200); failsafe++; if (myPlayer().isMoving()) failsafe = 0; } if (failsafe == 10) return false; return true; } @Override public void onStart() { log("I like women but they don't like me, and it's hard, yes siree"); } @Override public int onLoop() throws InterruptedException { switch (getState()) { case MINE: if (!myPlayer().isAnimating()) { RS2Object vein = closestObject(TIN_ID); if (vein != null) { if (vein.interact("Mine")) sleep(random(1000, 1500)); } } break; case WALK_TO_BANK: traversePath(path, false); sleep(random(1500, 2500)); break; case WALK_TO_MINE: traversePath(path, true); sleep(random(1500, 2500)); break; case BANK: RS2Object bank = closestObjectForName("Bank booth"); if (bank != null) { if (bank.interact("Bank")) { while (!client.getBank().isOpen()) sleep(250); client.getBank().depositAll(); } } break; } return random(200, 300); } @Override public void onExit() { log("Thanks ********a."); } @Override public void onPaint(Graphics g) { } } Quote Link to comment Share on other sites More sharing options...