Jump to content

Script gets stuck


Recommended Posts

Posted
NPC Tanner = sI.npcs.closest("Ellis");
		
		Area TANNING_SHOP = new Area(3277,3189,3270,3194);
		
		if(TANNING_SHOP.contains(sI.myPosition())) {
			if(!sI.getWidgets().isVisible(324)) {
				if(Tanner !=null) {
					Tanner.interact("Trade");
					new ConditionalSleep(2000) {
						
						@Override
						public boolean condition() throws InterruptedException {
							return sI.getWidgets().isVisible(324);
						}
					}.sleep();
				}
			} else {
				sI.getWidgets().interact(324, 13, "Tan ALL");
				new ConditionalSleep(2000) {
					
					@Override
					public boolean condition() throws InterruptedException {
						return !sI.getWidgets().isVisible(324);
					}
				}.sleep();
			}
			
		} else {
			sI.getWalking().webWalk(TANNING_SHOP);
		}

Im trying to make a simple tanning script. But sometimes it gets stuck in the widget of tanning the hides. I've tried a lot to fix it but i can't seem to get it to work. Can someone pls help me fix it? Thank you!

 

Posted (edited)

I think the problem is with your if and else statements when you check for visibility of the widget. Remove the else and keep the code outside that the widget is now visible and the code could be performed, otherwise, it will just open the widget as the if the statement was true and it won't do the negation of it which is tanning in the else statement...

Also, it would be better if you check that the inventory has the items to be tanned as kind of failsafe and so that it doesn't glitch if you have breaks enabled.

Edited by renoweno

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