February 19, 20187 yr 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, 20187 yr by faruk141
February 19, 20187 yr 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, 20187 yr by Duhstin
February 19, 20187 yr 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, 20187 yr by transmission
February 19, 20187 yr 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);
February 20, 20187 yr Author 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.
February 20, 20187 yr 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.
February 20, 20187 yr 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.
Create an account or sign in to comment