Skip 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.

World Hopping

Featured Replies

Hello. I've tried to implement a systematic world hopping feature into my script that will follow a list of worlds. It starts off fine but then after a few hops it will just hop back and forth between two worlds, occasionally hopping to another world on the list. Sometimes it will hop, log in, and then log right back out and hop again. Here is my world hopping code:

 

Ohh and it tends to hop between 381 and 394 mainly.

public int[] worlds = {308, 316, 381, 382, 383, 384, 393, 394};
public int i;
for(i = 1; i < 8;) {
     worldHopper.hop(worlds[i]);
     i++;
     new ConditionalSleep(1000) {
           @Override
            public boolean condition() throws InterruptedException {
                 return myPlayer().isVisible();
            }
      }.sleep();
}

Edited by lovelypker

Quickly rewrote this for you, let me know if something isn't clear smile.png (derived from your code, it's not how I would do it myself, but this should work ^^)

final int[] worlds = {308, 316, 381, 382, 383, 384, 393, 394};
public int i = 0;
worldHopper.hop(worlds[i]);

 new ConditionalSleep(5000) {
           @Override
            public boolean condition() throws InterruptedException {
                 return myPlayer().isVisible(); // instead of using isVisible you should probably use the client's login state.
            }
      }.sleep();

if (i >= worlds.length) {
i = 0;
}
else {
i++;
}

Edited by Botrepreneur

this is because your using a for loop, which basically when is executed it starts from the beginning of the array and goes up. But that's bad. Becasue your telling it yo hop world back and fort. You could either have a list of worlds. Use the first index of the list. When you hop there you would remove the first index. you do it until the list is empty. When its empty, you could just readd them.

  • Author

 

Quickly rewrote this for you, let me know if something isn't clear smile.png (derived from your code, it's not how I would do it myself, but this should work ^^)

final int[] worlds = {308, 316, 381, 382, 383, 384, 393, 394};
public int i = 0;
worldHopper.hop(worlds[i]);

 new ConditionalSleep(5000) {
           @Override
            public boolean condition() throws InterruptedException {
                 return myPlayer().isVisible(); // instead of using isVisible you should probably use the client's login state.
            }
      }.sleep();

if (i >= worlds.length) {
i = 0;
}
else {
i++;
}

Thanks for your help!  I'll test this out and see how it goes.

 

this is because your using a for loop, which basically when is executed it starts from the beginning of the array and goes up. But that's bad. Becasue your telling it yo hop world back and fort. You could either have a list of worlds. Use the first index of the list. When you hop there you would remove the first index. you do it until the list is empty. When its empty, you could just readd them.

Ohh ok, that makes a lot of sense actually. I think your method sounds very logical, I'll try it out.

Thanks for your help!  I'll test this out and see how it goes.

 

Ohh ok, that makes a lot of sense actually. I think your method sounds very logical, I'll try it out.

if you have an question, or confused on how to do it. Ask me i could help you out. With a pm or quote me so i get the notification.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.