Jump to content

When you level Wc Stuck.


Recommended Posts

Posted

i was Woodcutting and i did when you hit lvl 31 you need to go to willows but its stuck on the dialog screen when you level up on lvl 31 and the bot just gives me nulls because it cant move when i click it away the bot goes on and works fine.

 

i tryed with this: 

this.dialogues.completeDialogue();

but no effect.

Posted (edited)

It should ignore the level up widget... Post your code where it gets stuck

After i click the level up away it works fine this code happens then ->
 if(level >= 31 && this.myPosition().getY() > 3402)
       try{
        inventory.dropAll("Oak logs");
        this.localWalker.walkPath(PathWillows);
       }catch(Exception e){
       
       }

and if the level up dialogues is there this happend and there is no willow tree in sight so thats why the error. ->

	  		if (level >= 31){
		    	if ((!this.inventory.isFull()) && (!myPlayer().isAnimating()))
			    {
			      Entity tree = this.objects.closest(11755);
			    
			      for (int i = 0; i < Willow.length; i++) {   
			    if(tree.isVisible() && tree.getY() == Willow[i])
			    	try{	
			    			tree.interact("Chop Down");
			    			status = "Cutting Willow.";
			    	sleep(random(75, 150));
			    	}catch(Exception e){
			    	
			    	}	    
			      }			 
			}  
		    	}

i got it need to call it before cutting in loop :p

Edited by Mocro
Posted (edited)

If you fixed it, then great.

 

However, why are you a for loop here?

for (int i = 0; i < Willow.length; i++) {   // why?
			    	    
}	

Also, you don't really need to try and catch when doing an action. Just make sure the object is not null.

cords dont want all tree's just 2 

 

i  always use try and catch i just forgot on that one lol 

 

anyway its fixed now i put it at the first line of the loop 

before cutting the tree :)

Edited by Mocro
Posted

Make a filter to only get the 2 desired willow trees. I would not recommend using a for loop like you did.

 

Btw, do you know what try & catch is for? If not, read it up and you'll then understand why you don't have to use it like you are now.

i know what a try catch is i always use it i just forgot for that one :P

 

can you send me a example with a filter please? never did that before

Posted (edited)

i know what a try catch is i always use it i just forgot for that one tongue.png

 

can you send me a example with a filter please? never did that before

Dude, I am suggesting to NOT use try & catch like how you are using it.

 

Try something like this:

RS2Object tree = getObjects().closest(new Filter<RS2Object>() {

			@Override
			public boolean match(RS2Object obj) {
				return obj.getPosition().equals(WILLOW_POSITION_1) || obj.getPosition().equals(WILLOW_POSITION_2);
			}
			
});

then check if tree != null and do action. 

 

Play around with it and learn how to use filters; it will help you A LOT when using filters.

Edited by Woody
  • Like 1
Posted

Dude, I am suggesting to NOT use try & catch like how you are using it.

 

Try something like this:

RS2Object tree = getObjects().closest(new Filter<RS2Object>() {

			@Override
			public boolean match(RS2Object obj) {
				return obj.getPosition().equals(WILLOW_POSITION_1) || obj.getPosition().equals(WILLOW_POSITION_2);
			}
			
});

then check if tree != null and do action. 

 

Play around with it and learn how to use filters; it will help you A LOT when using filters.

ow lmao soz why not though about the try and catch and thanks for the filter :)

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