Jump to content

Script gets stuck


MarWo22

Recommended Posts

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!

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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