Jump to content

WorldHopping


Recommended Posts

Posted (edited)

Hello so i have problem with worldhopping

   (I'm not good at conditional sleep so please help me to solve it smile.png   )

if(store.isOpen()) {
			Item test1 = getStore().getItem("Item");
			 if (test1 != null && getStore().getAmount("Item") > 0) {
				 getStore().buy("Item", 5);
			 }
		}
		Item test2 = getStore().getItem("Item2");
		 if (test2 != null && getStore().getAmount("Item2") > 0) {
			 getStore().buy("Item2", 5);
	  }
		 if (getStore().isOpen()) {
             getStore().close();
             new ConditionalSleep(5500, 6000) {
                 public boolean condition() throws InterruptedException {
                     return !getStore().isOpen();
                 }
             }.sleep();
             getWorlds().hopToP2PWorld();
             new ConditionalSleep(15000, 25000) {
                 public boolean condition() throws InterruptedException {
                     return myPlayer().exists();
                 }
             }.sleep();
	}
}
    
}

The problem is after world hop it starts to eat all my cpu.So if sombody could help me that would be great biggrin.png

Edited by cattycatcat
Posted (edited)

myPlayer() might be null, try checking if it's not null in the ConditionalSleep

 

Also, you can define the amount of time the ConditionalSleep loop waits between each iteration like so:

(2nd parameter of the constructor)

new ConditionalSleep(random(15000, 25000), random(300,800)) {
  public boolean condition() throws InterruptedException {
    return condition;
  }
}.sleep();
Edited by btsfan
Posted (edited)

Untested:

boolean hop = false;
int oldWorld = -1;

if (hop) {
			
	if (getStore().isOpen()) {
		getStore().close();
		return 300;
	}
			
	getWorlds().hopToP2PWorld();
			
	if (oldWorld != getWorlds().getCurrentWorld())
		hop = false;
			
	return 300;
			
}

if (!getStore().isOpen()) {
	// open store
	return 300;
}

String item1Name = "Item1";
String item2Name = "Item2";
Item item1 = getStore().getItem(item1Name);
Item item2 = getStore().getItem(item2Name);

if (item1 != null && getStore().getAmount(item1Name) > 0) {
	getStore().buy(item1Name, 5);
	return 300;
}

if (item2 != null && getStore().getAmount(item2Name) > 0) {
	getStore().buy(item2Name, 5);
	return 300;
}

hop = true;
oldWorld = getWorlds().getCurrentWorld();

Hope you get the gist of it :)

Also use HHopper doge.png

Edited by House

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...