Trivial Posted March 20, 2015 Share Posted March 20, 2015 In my hunting script, I check if a box trap is in an area that is 1x1, and if not, make the player walk to that using the localWalker, but it doesnt seem to do anything even though I tried both localWalker.walk(the 1x1 area) and localWalker.walk(x & y for the tile). What could be the problem? Heres some of the code: if((normalTrap != null) && !spot1.contains(normalTrap)){ return State.TRAP1; } case TRAP1: log("Starting trap1"); if(spot1.contains(myPlayer())){ inventory.interact("Lay", TRAP_ITEM_ID); trapsDown ++; sleep(random(1000,1500)); } else { log("Walking to spot1"); localWalker.walk(spot1, true); //or tile x & y } break; Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted March 20, 2015 Share Posted March 20, 2015 I don't use local walker but I believe there is a threshold you need to set to 0, meaning use the exact position. Otherwise it will accept positions within a couple away from the one specified. Quote Link to comment Share on other sites More sharing options...
Twin Posted March 20, 2015 Share Posted March 20, 2015 if (!spot1.contains(myPlayer())) { //if you're not standing in the hunting area log("Returning to Hunting Area"); localWalker.walk(spot1.getRandomPosition(0)); //Walks into hunting area } Also, reset your count,then add one to trap count if trap1 is the first trap you're placing. Just Incase of DCs and what not. If(box==null&&!box.exist())//don't quote me on the exist part return state.Trap1; case trap1: Inventory.interact(xxxxxxx) Trapcount == 0; Trapcount++; Quote Link to comment Share on other sites More sharing options...
Trivial Posted March 21, 2015 Author Share Posted March 21, 2015 (edited) Still not working. Everything else works except for the walking part. I also tried a custom path walking method and giving it the tile its supposed to walk to, but still it does absolutely nothing. Heres the area its supposed to walk to: final Area spot1 = new Area(2503, 2881, 2503, 2881); localWalker.walk(spot1.getRandomPosition(0)); This doesnt work either: private Position spot1Pos = new Position(2503, 2881, 0); localWalker.walk(spot1Pos); Edited March 21, 2015 by Damighty Quote Link to comment Share on other sites More sharing options...
Precise Posted March 21, 2015 Share Posted March 21, 2015 are you walking along a path or just a single tile? Quote Link to comment Share on other sites More sharing options...
Apaec Posted March 21, 2015 Share Posted March 21, 2015 The code should work, you must have got something else wrong. Are you sure the script is getting to that line when it's supposed to? check this but putting a log before it in an attempt to debug it Are you trying to walk to a position which is off the minimap / that kind of distance away? In which case you're probably better off using the localWalker.walkPath(Position[] path) method as this client doesn't currently have webwalking (still! x)) I needed a third point to justify bullet points so there we go Apa Quote Link to comment Share on other sites More sharing options...
Trivial Posted March 21, 2015 Author Share Posted March 21, 2015 The code should work, you must have got something else wrong. Are you sure the script is getting to that line when it's supposed to? check this but putting a log before it in an attempt to debug it Are you trying to walk to a position which is off the minimap / that kind of distance away? In which case you're probably better off using the localWalker.walkPath(Position[] path) method as this client doesn't currently have webwalking (still! x)) I needed a third point to justify bullet points so there we go Apa The code did get executed, but for some reason it just didnt want to walk to that tile. Im using Pandemic's walking method now and its working, but theres another problem which is that I dont know how to make the bot click a tile on the screen instead of clicking the minimap. Heres the method: public boolean walkTile(Position p) throws InterruptedException { mouse.click(new MiniMapTileDestination(bot, p), false); int fail = 0; while (myPosition().distance(p) > 2 && fail < 10) { sleep(500); if (!myPlayer().isMoving()) fail++; } return fail != 10; } The point is to move to an exact 1-tile accurate position to place a trap on that particular tile, but sometimes that method gets stuck trying to spam click the minimap because I'm right next to the tile it should be clicking on. Quote Link to comment Share on other sites More sharing options...
Apaec Posted March 21, 2015 Share Posted March 21, 2015 The code did get executed, but for some reason it just didnt want to walk to that tile. Im using Pandemic's walking method now and its working, but theres another problem which is that I dont know how to make the bot click a tile on the screen instead of clicking the minimap. Heres the method: public boolean walkTile(Position p) throws InterruptedException { mouse.click(new MiniMapTileDestination(bot, p), false); int fail = 0; while (myPosition().distance(p) > 2 && fail < 10) { sleep(500); if (!myPlayer().isMoving()) fail++; } return fail != 10; } The point is to move to an exact 1-tile accurate position to place a trap on that particular tile, but sometimes that method gets stuck trying to spam click the minimap because I'm right next to the tile it should be clicking on. if (map.distance(position) <= 5) position.interact("Walk here"); Quote Link to comment Share on other sites More sharing options...
Botre Posted March 21, 2015 Share Posted March 21, 2015 public static boolean walkExact(Script script, Position position) { WalkingEvent event = new WalkingEvent(position); event.setMinDistanceThreshold(0); return script.execute(event).hasFinished(); } ^From Xerion or Frostie if I'm not mistaken. Works like a charm Quote Link to comment Share on other sites More sharing options...
Trivial Posted March 21, 2015 Author Share Posted March 21, 2015 Thanks a lot guys, both came up with something I was exactly looking for Quote Link to comment Share on other sites More sharing options...