Articron Posted May 18, 2013 Share Posted May 18, 2013 import org.osbot.script.MethodProvider; import org.osbot.script.Script; import org.osbot.script.rs2.Client; import org.osbot.script.rs2.map.Position; public class Area { private int z; private int maxX; private int maxY; private int minX; private int minY; Script script; public Area(int x1, int y1, int x2, int y2,int z) { this.z = z; maxX = (x1 > x2? x1 : x2); maxY = (y2 > y1? y2 : y2); minX = (x1 < x2? x1 : x2); minY = (y2 < y1? y2 : y1); } public boolean isInArea(Client c) { if (c.getMyPlayer().getX() >= minX && c.getMyPlayer().getX() <= maxX && c.getMyPlayer().getY() <= maxY && c.getMyPlayer().getY() >= minY) return true; else return false; } public void walktoZone() throws InterruptedException { int xDeficit = maxX - minX; int yDeficit = maxY - minX; Position toWalk = new Position(maxX - (MethodProvider.random(0,xDeficit)), maxY - (MethodProvider.random(0,yDeficit)), z); script.walkMiniMap(toWalk); } } Link to comment Share on other sites More sharing options...
Brainfree Posted May 18, 2013 Share Posted May 18, 2013 I must note that this will not work for irregular shaped area. 1 Link to comment Share on other sites More sharing options...
Developer Maxi Posted May 18, 2013 Developer Share Posted May 18, 2013 The OSBot Area has no problems as of 1.5.6. Link to comment Share on other sites More sharing options...
Articron Posted May 18, 2013 Author Share Posted May 18, 2013 The OSBot Area has no problems as of 1.5.6. As the Area's get broken through updates occasionally, I think this topic will have a point nevertheless ;) Link to comment Share on other sites More sharing options...
Developer Maxi Posted May 18, 2013 Developer Share Posted May 18, 2013 As the Area's get broken through updates occasionally, I think this topic will have a point nevertheless They won't anymore. Link to comment Share on other sites More sharing options...