Jump to content

widget delay


MightySir2

Recommended Posts

i have a script for tanning, but when character trades with NPC there is huge(5 sec) delay in which the character doesnt tan hides :

any help would be appreciated biggrin.png

conditions:

	if (inventory.isEmptyExcept(995))
			//just withdraws hides to initiate script
			return State.BANK;
		 if(inventory.contains(1743)&&bank.isOpen())
			//if there is tanned hides and bank is open it deposits them/ withdraws untanned hides	
			 return State.BANKB;
		 
		 if(inventory.contains(1743))
			//returns to bank from tanner to open it	
			 return State.BACK;
		 
		 if(ellis!=null&&inventory.contains(1739))
			//tans hides when at tanner	
			 return State.TAN;
		if(inventory.contains(1739))
			//goes to tanner from bank
			return State.WALK;
		
		 

tan action:

case TAN:
			NPC ellis = npcs.closest("Ellis");
			ellis.interact("Trade"); 
			sleep(random(10, 15));
			getWidgets().getWidgetContainingText("Hard leather").interact("Tan All");
			  sleep(random(50, 200));
			break; 
Link to comment
Share on other sites

case TAN:
        RS2Widget w = getWidgets().getWidgetContainingText("Hard leather");
        if (w != null && w.isVisible()) {
              w.interact("Tan All");
        } else {
	NPC ellis = npcs.closest("Ellis");
        if (ellis != null && ellis.exists()) {
	    ellis.interact("Trade"); 
            //either put a conditional sleep until interface is open here, or just stick with a static sleep and let state machine do the work eg:
            sleep(random(400,500) + random(400,500));
        } else {
            sleep(random(400,500) + random(400,500));
        }
	break; 

Re-written tan case... change the tan condition in the getState to:

 if(ellis!=null&& ellis.exists() && inventory.contains(1739))
			//tans hides when at tanner	
			 return State.TAN;
Edited by Apaec
  • Like 2
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...