gorgas8 Posted January 8, 2016 Share Posted January 8, 2016 public void antiBan2() throws InterruptedException { int random = random(1,3); if (random == 1) { sleep(random(1000, 2000)); mouse.moveRandomly(random(1000, 2000)); if (random == 2) { sleep(random(1000, 2000)); mouse.moveRandomly(random(300, 1000)); mouse.moveRandomly(random(1000, 2000));} } } This should move mouse 2/3 times, but it works only like 1/100. The same thing happens with path new Position(3027 +random(-2, 2),3709 +random(-2, 2),0) each time its used it should be random, but instead path is always repeated the same and actually changes only like 1/100 time. Quote Link to comment Share on other sites More sharing options...
Explv Posted January 8, 2016 Share Posted January 8, 2016 (edited) public void antiBan2() throws InterruptedException { int random = random(1,3); if (random == 1) { sleep(random(1000, 2000)); mouse.moveRandomly(random(1000, 2000)); if (random == 2) { sleep(random(1000, 2000)); mouse.moveRandomly(random(300, 1000)); mouse.moveRandomly(random(1000, 2000));} } } This should move mouse 2/3 times, but it works only like 1/100. The same thing happens with path new Position(3027 +random(-2, 2),3709 +random(-2, 2),0) each time its used it should be random, but instead path is always repeated the same and actually changes only like 1/100 time. Your logic is flawed that's why. You have nested if(random == 2) inside if(random == 1). So the code inside if(random == 2) will never be executed, because it can only be reached if random = 1... It should look more like: public void antiBan2() throws InterruptedException { int random = random(1,3); switch(random){ case 1: sleep(random(1000, 2000)); mouse.moveRandomly(random(1000, 2000)); break; case 2: sleep(random(1000, 2000)); mouse.moveRandomly(random(300, 1000)); mouse.moveRandomly(random(1000, 2000)); break; } } The same thing happens with path new Position(3027 +random(-2, 2),3709 +random(-2, 2),0) each time its used it should be random, but instead path is always repeated the same and actually changes only like 1/100 time. That is because the walker in OSBot walks to a position within (i think) 2 tile accuracy. If you want it to walk to the exact tile, you will need to create your own WalkingEvents. Edited January 8, 2016 by Explv 2 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted January 8, 2016 Share Posted January 8, 2016 Your logic is flawed that's why. You have nested if(random == 2) inside if(random == 1). So the code inside if(random == 2) will never be executed, because it can only be reached if random = 1... It should look more like: public void antiBan2() throws InterruptedException { int random = random(1,3); switch(random){ case 1: sleep(random(1000, 2000)); mouse.moveRandomly(random(1000, 2000)); break; case 2: sleep(random(1000, 2000)); mouse.moveRandomly(random(300, 1000)); mouse.moveRandomly(random(1000, 2000)); break; } } That is because the walker in OSBot walks to a position within (i think) 2 tile accuracy. If you want it to walk to the exact tile, you will need to create your own WalkingEvents. This ^ You nested the if statements instead of putting them behind eachother Khaleesi Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted January 8, 2016 Share Posted January 8, 2016 o boy 1 Quote Link to comment Share on other sites More sharing options...
gorgas8 Posted January 10, 2016 Author Share Posted January 10, 2016 (edited) I tried walking.walk(new Position(3027 +random(-2, 2),3709 +random(-2, 2),0)); walking.webWalk(new Position(3027 +random(-2, 2),3709 +random(-2, 2),0)); Position[] PATH = {new Position(3020 +random(-2, 2),3700 +random(-2, 2),0), new Position(3027 +random(-2, 2),3709 +random(-2, 2),0)}; localWalker.walkPath(PATH); it seems, that all methods which involve new Position , will generate 1 random position and will repeat it. while localWalker.walk(3027 +random(-2,2), 3709 +random(-2,2)); generates new position each time its used.. Edited January 10, 2016 by gorgas8 Quote Link to comment Share on other sites More sharing options...