faruk141 Posted February 19, 2018 Share Posted February 19, 2018 (edited) Hi OSbot community, im working on my first script , which is a simple iron miner. I have defined an area, where the player(bot) is supposed to stay, but i dont know which command makes the bot stay in that area . Can someone help me? Edited February 19, 2018 by faruk141 Quote Link to comment Share on other sites More sharing options...
Duhstin Posted February 19, 2018 Share Posted February 19, 2018 (edited) 8 minutes ago, faruk141 said: Hi OSbot community, im working on my first script , which is a simple iron miner. I have defined an area, where the player(bot) is supposed to stay, but i dont know which command makes the bot stay in that area . Can someone help me? if(AREA.contains(ORE.getPosition()){ // INTERACT } or if you want to walk back to the area if you leave it, if(!AREA.contains(myPosition())){ getWalking().webWalk(AREA.getRandomPosition()); } Edited February 19, 2018 by Duhstin 1 Quote Link to comment Share on other sites More sharing options...
transmission Posted February 19, 2018 Share Posted February 19, 2018 (edited) could use player get area and if hes not in ur area walk to it or just check if the iron is in ur area and then mine it if its not sleep EDIT: yup what the dude above me said. Edited February 19, 2018 by transmission 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted February 19, 2018 Share Posted February 19, 2018 Area myArea = new Area(0,0,0,0); if (myArea.contains(myPlayer()) //we are in the area else //we are not in the area getWalking().walk(myArea); To grab rocks within your area use a Filter<RS2Object> in .closest(Filter<> filter); 1 Quote Link to comment Share on other sites More sharing options...
Juggles Posted February 19, 2018 Share Posted February 19, 2018 Check if in area, if not walk there 1 Quote Link to comment Share on other sites More sharing options...
faruk141 Posted February 20, 2018 Author Share Posted February 20, 2018 12 hours ago, Duhstin said: if(AREA.contains(ORE.getPosition()){ // INTERACT } or if you want to walk back to the area if you leave it, if(!AREA.contains(myPosition())){ getWalking().webWalk(AREA.getRandomPosition()); } thank you very much! i used the AREA.contains(ORE) method and its working. There was another iron ore with the same id outside the area and because of this i needed a solution for this problem. Quote Link to comment Share on other sites More sharing options...
Butters Posted February 20, 2018 Share Posted February 20, 2018 2 hours ago, faruk141 said: thank you very much! i used the AREA.contains(ORE) method and its working. There was another iron ore with the same id outside the area and because of this i needed a solution for this problem. Not wise to use ids for rocks, check this out Also, though basically the same, check what Chris wrote. His snippet is basic and clean. 1 Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted February 20, 2018 Share Posted February 20, 2018 15 hours ago, Duhstin said: if(AREA.contains(ORE.getPosition()){ // INTERACT } or if you want to walk back to the area if you leave it, if(!AREA.contains(myPosition())){ getWalking().webWalk(AREA.getRandomPosition()); } Ore is a RS2Object so it's an entity. You can just use contains(ORE) in that case. 1 Quote Link to comment Share on other sites More sharing options...