Jump to content

Widgets


iJodix

Recommended Posts

There's no need to use an array there because there's only 1 string in it. Just use a string instead of an array. You should also null check that widget.

thats because de decompiled a .class fiel fo someone ;)

 

 

 

It works but is it the right way of using the new widget system ?

			        if (bankBooth.interact(new String[] { "Bank" }))
			            sleep(random(800, 1200));
			        {
			        	if (widgets.isVisible(12)) {
				    		inventory.interact("Deposit-All", new String[] { "Bones" });
	}
				        }

 

Not sure what you are trying to do here, why a widget check?

Link to comment
Share on other sites

thats because de decompiled a .class fiel fo someone ;)

He is checking to see if bank is open.

Not sure what you are trying to do here, why a widget check?

Also bank. IsOpen doesn't work for now use widget. Bank. Isopen. Until the devs fixed that. Diviniry will make an official post about this later Edited by josedpay
Link to comment
Share on other sites

I guess whoever posted those scripts on pastebin got em by decompiling.

And thanks, i will.

 

haha could be biggrin.png

You can alos just ask me on skype if you got troubles ^^

Also bank. IsOpen doesn't work for now use widget. Bank. Isopen. Until the devs fixed that. Diviniry will make an official post about this later

 

No way I'm going to change this in all my script at maybe 100 positions -_-

They better get this fixed asap :p

Edited by Khaleesi
Link to comment
Share on other sites

I don't see why not. I've been running a NON ported script that runs fine, banking, interacting etc.

aLiQX6r.png

 

		RS2Object bankBooth = objects.closest("Bank booth");
	    if (bankBooth != null) {
	        if (bankBooth.interact("Bank")) {
		          while (bank.isOpen())
		          {
		            sleep(random(800, 1200));
		            bank.depositAll();
		            sleep(random(800, 1200));
		            bank.close();
		            sleep(random(800, 1200));
		          }
	        }
	    }

This one just hovers the close button, so am guessing that isOpen() works in this case but i also tried widgets.bank.close(); & widgets.bank.isOpen(); & widgets.bank.depositAll(); and it doesn't do anything, i guess i must be doing something wrong then.

Edited by iJodix
Link to comment
Share on other sites

  • Developer
		RS2Object bankBooth = objects.closest("Bank booth");
	    if (bankBooth != null) {
	        if (bankBooth.interact("Bank")) {
		          while (bank.isOpen())
		          {
		            sleep(random(800, 1200));
		            bank.depositAll();
		            sleep(random(800, 1200));
		            bank.close();
		            sleep(random(800, 1200));
		          }
	        }
	    }
This one just hovers the close button, so am guessing that isOpen() works in this case but i also tried widgets.bank.close(); & widgets.bank.isOpen(); & widgets.bank.depositAll(); and it doesn't do anything, i guess i must be doing something wrong then.

There is no need to do widgets.bank, it is the same instance as bank. That code will of course not work, because at the moment the interact method returns the interface is not open so the code between the while block is never executed.

 

pseudo code

if booth.interact("Bank") {
    // wait for the bank to be open
    new ConditionalSleep... {
        boolean { return bank.isOpen }
    }.sleep
    // perform banking logic here
    if (logic performed correctly) {
        close bank
            conditional sleep to make sure bank is closed
                continue what you want to do
}
There is a method in the API to open banks, you know that right?

This is the actual code:


    /**
     * Searches for the best bank, based on type and distance from player. This
     * method will only interact with RS2Objects.
     *
     * @return If bank was already open, or opened successfully.
     */
    public boolean open() throws InterruptedException {
        if (isOpen())
            return true;

        final RS2Object bankObject = bot.getMethods().objects.closest(
                new NameFilter<RS2Object>("Bank booth", "Bank chest"),
                new ActionFilter<RS2Object>("Bank", "Use"));
        if (bankObject != null && map.canReach(bankObject)) {
            Event event = new InteractionEvent(bankObject, "Bank", "Use");
            execute(event);
            if (event.hasFinished()) {
                return new ConditionalSleep(5000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return isOpen();
                    }
                }.sleep();
            }
        }
        return isOpen();
    }
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...