January 11, 201610 yr public boolean isFletching() { boolean isFletching = false; Timer timer = new Timer(1800, null); while (timer.isRunning() && !isFletching) { isFletching = myPlayer().getAnimation() != -1 ? true : isFletching; } return isFletching; } public boolean isStringing() { boolean isStringing = false; Timer timer = new Timer(1200, null); while (timer.isRunning() && !isStringing) { isStringing = myPlayer().getAnimation() != -1 ? true : isStringing; } return isStringing; } These doesnt work can you tell me what im doing wrong?. Edited January 11, 201610 yr by Assnerd
January 11, 201610 yr cant u do a while ur player is animating do nothing instead of timer OnLoop(){ If (!myPlayer().isAnimating()) { fletching knife 2 log shit } return(random(100,500); } somthng like tht
January 11, 201610 yr Don't use while loops in osbot please. Here's my secret. Create a timer. Set it to 0. Check the time passed. Before your fletching method. (Select knife and log). Do a animation check if true reset the timer. Then do a else if statements after. Check the timer and see if it passed like 4 secs. Then you would use your fletching method Edited January 11, 201610 yr by Joseph
January 11, 201610 yr Why are you using a timer like this? There is much more solid logic that you could use here.
January 11, 201610 yr Don't use while loops in osbot please. Here's my secret. Create a timer. Set it to 0. Check the time passed. Before your fletching method. (Select knife and log). Do a animation check if true reset the timer. Then do a else if statements after. Check the timer and see if it passed like 4 secs. Then you would use your fletching method Can I ask why while loops are bad? I understand that some may become infinite loops, is there another reason?
January 11, 201610 yr Author Don't use while loops in osbot please. Here's my secret. Create a timer. Set it to 0. Check the time passed. Before your fletching method. (Select knife and log). Do a animation check if true reset the timer. Then do a else if statements after. Check the timer and see if it passed like 4 secs. Then you would use your fletching method Could you give me an example (code) ? im still learning :E thanks in advance
January 11, 201610 yr Can I ask why while loops are bad? I understand that some may become infinite loops, is there another reason? You can use them, but make sure to properly break out of them. Getting a user stuck for 8 hours because a while loop didn't break properly is pretty annoying I didn't even use 1 while loop in all of my scripts Could you give me an example (code) ? im still learning :E thanks in advance Basicly this: (I'm using my own timer class though, not sure how osbots timer work) Timer animationTimer = new Timer(0); public void fletch(){ if (script.myPlayer().isAnimating()) animationTimer.reset(); if (animationTimer.getElapsed() > 2000) { //time between animations //start fletching }else{ //we are fletching } } Khaleesi Edited January 11, 201610 yr by Khaleesi
January 11, 201610 yr Author You can use them, but make sure to properly break out of them. Getting a user stuck for 8 hours because a while loop didn't break properly is pretty annoying I didn't even use 1 while loop in all of my scripts Basicly this: (I'm using my own timer class though, not sure how osbots timer work) Timer animationTimer = new Timer(0); public void fletch(){ if (script.myPlayer().isAnimating()) animationTimer.reset(); if (animationTimer.getElapsed() > 2000) { //time between animations //start fletching }else{ //we are fletching } } Khaleesi thx Edited January 11, 201610 yr by Assnerd
January 11, 201610 yr Don't use while loops in osbot please. Here's my secret. Create a timer. Set it to 0. Check the time passed. Before your fletching method. (Select knife and log). Do a animation check if true reset the timer. Then do a else if statements after. Check the timer and see if it passed like 4 secs. Then you would use your fletching method u made my day l0l
Create an account or sign in to comment