Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Timer?

Featured Replies

 

 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 by Assnerd

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

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 by Joseph

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?

  • 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

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 biggrin.png

 

I didn't even use 1 while loop in all of my scripts smile.png

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 by Khaleesi

  • 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 biggrin.png

 

I didn't even use 1 while loop in all of my scripts smile.png

 

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 by Assnerd

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

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.