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.

Hopping worlds

Featured Replies

Hey guys; I need to be able to hop to worlds basically everytime; for some reason the Hopper supplied by OSbot is a tad buggy and sometimes doesnt actually go hop worlds or hops to a world it cant EG 500 lvl or members if f2p account is used;

I have tried to come up with something that could possibly help me; but Im not sure how to prevent it from trying to log into the world it currently is if the random lands on that world;

int rand = random(10);
			if (rand == 1) {
				hopper.hop(1, () -> false);
			}
			if (rand == 2) {
				hopper.hop(8, () -> false);
			}
			if (rand == 3) {
				hopper.hop(16, () -> false);
			}
			if (rand == 4) {
				hopper.hop(26, () -> false);
			}
			if (rand == 5) {
				hopper.hop(35, () -> false);
			}
			if (rand == 6) {
				hopper.hop(82, () -> false);
			}
			if (rand == 7) {
				hopper.hop(83, () -> false);
			}
			if (rand == 8) {
				hopper.hop(84, () -> false);
			}
			if (rand == 9) {
				hopper.hop(93, () -> false);
			}
			if (rand == 10) {
				hopper.hop(94, () -> false);
			}

any feedback would be sweet (: 

or if someone else has a snippet that could be useful here please post (:

Check if the player is already in that world, if true, don't log into that world. If this doesn't make sense to you, let me know.

Edited by Sphiinx

  • Author
25 minutes ago, Sphiinx said:

Check if the player is already in that world, if true, don't log into that world. If this doesn't make sense to you, let me know.

it does but will I need to add to every line ? or can I do it to before the first random ?

So far I've haven't experienced any issues with the hopper. Are you sure you're making use of the correct methods?
Also, consider using a switch instead of multiple if statements.
You should use something of this sort:

int hopTo = -1;
int rand = random(1,10);
  switch (rand) {
  case 1:
  	hopTo = 1;
  break;
  case 2:
  	hopTo = 8;
  break;
  //add remaining cases
}

if (hopTo != -1 && hopTo != getWorlds().getCurrentWorld){
getWorlds().hop(hopTo);
}

Here's an even better solution with an array instead of a switch

int hopTo = -1;
int[] worlds = {1,8,16}; //add your worlds here
int rand = random(0, worlds.length - 1); //arrays start from index 0
hopTo = worlds[rand];

if (hopTo != -1 && hopTo != getWorlds().getCurrentWorld){
getWorlds().hop(hopTo);
}

 

Edited by Adept

  • Author
18 minutes ago, Adept said:

So far I've haven't experienced any issues with the hopper. Are you sure you're making use of the correct methods?
Also, consider using a switch instead of multiple if statements.
You should use something of this sort:


int hopTo = -1;
int rand = random(1,10);
  switch (rand) {
  case 1:
  	hopTo = 1;
  break;
  case 2:
  	hopTo = 8;
  break;
  //add remaining cases
}

if (hopTo != -1 && hopTo != getWorlds().getCurrentWorld){
getWorlds().hop(hopTo);
}

Here's an even better solution with an array instead of a switch


int hopTo = -1;
int[] worlds = {1,8,16}; //add the other worlds (make sure sure you have as much elements as the maximum value of the random)
int rand = random(0,9); //arrays start from index 0
hopTo = worlds[rand];

if (hopTo != -1 && hopTo != getWorlds().getCurrentWorld){
getWorlds().hop(hopTo);
}

 

Thanks mate Ill give it a try !

9 minutes ago, Zappster said:

@FrostBug did something with this a couple of years ago. Please see:

 

That could be the one I was looking for I saw houses which was a remake of this one I think

 

  • Author
1 hour ago, Adept said:

So far I've haven't experienced any issues with the hopper. Are you sure you're making use of the correct methods?
Also, consider using a switch instead of multiple if statements.
You should use something of this sort:


int hopTo = -1;
int rand = random(1,10);
  switch (rand) {
  case 1:
  	hopTo = 1;
  break;
  case 2:
  	hopTo = 8;
  break;
  //add remaining cases
}

if (hopTo != -1 && hopTo != getWorlds().getCurrentWorld){
getWorlds().hop(hopTo);
}

Here's an even better solution with an array instead of a switch


int hopTo = -1;
int[] worlds = {1,8,16}; //add the other worlds (make sure sure you have as much elements as the maximum value of the random)
int rand = random(0,9); //arrays start from index 0
hopTo = worlds[rand];

if (hopTo != -1 && hopTo != getWorlds().getCurrentWorld){
getWorlds().hop(hopTo);
}

 

The case switches worked better; the bottom one seems to skip world hoping (: thanks so much mate; it doesnt go to wrong worlds now; and if it gets stuck I can set it to continue (: 

6 minutes ago, whipz said:

The case switches worked better; the bottom one seems to skip world hoping (: thanks so much mate; it doesnt go to wrong worlds now; and if it gets stuck I can set it to continue (: 

I'd recommend using the bottom one.
I edited the code so that all you have to do is add world to the "worlds" array. Copy the code again from the original reply and try again.

Edited by Adept

  • Author
Just now, Adept said:

I'd recommend using the bottom one. Did you add the worlds in the worlds array? It's probably why it's not working.

i did ): still didnt work just skipped it all together it said it was going to but didnt I had 10 worlds in total so 0 - 9 is 10 im sure?

Create an account or sign in to comment

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.