Jump to content

Problem with widgets [bank.isOpen()]


Abuse

Recommended Posts

Once in a while a widget API call will fail resulting in:

[ERROR][Bot #1][02/11 10:40:58 PM]: Failed to wrap : class client.YR
java.lang.RuntimeException: Could not initiate wrapper : RS2Widget
	at org.osbot.core.api.Wrapper.wrap(bg:159)
	at org.osbot.rs07.api.Widgets.getWidgets(gg:120)
	at org.osbot.rs07.api.Widgets.isVisible(gg:3)
	at org.osbot.rs07.api.Bank.isOpen(fn:471)
	at blastFurnace$10.condition(blastFurnace.java:471)
	at org.osbot.rs07.utility.ConditionalSleep.sleep(ed:70)
	at blastFurnace.openBank(blastFurnace.java:473)
	at blastFurnace.depositAll(blastFurnace.java:501)
	at blastFurnace.takeBars(blastFurnace.java:388)
	at blastFurnace.onLoop(blastFurnace.java:210)
	at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ff:33)
	at java.lang.Thread.run(Unknown Source)

Sometimes bank.isOpen() will return true when the banking interface is not visible, and has not been accessed in a few seconds I cannot accurately reproduce the bug, however it occurs more often when my system is under higher load

 

I'm using Java JDK 8 (64bit only), latest client. This only occurs in Mirror mode

 

The function in question is

	private boolean openBank() throws InterruptedException{
		Entity chest = objects.closest(chestID);
		if(bank.isOpen()){
			return true;
		}	else {
			widgets.closeOpenInterface();
			if(widgets.get(28, 107) != null && widgets.get(28, 107).isVisible()){
				clickMiniMapPosition(chest.getPosition());
				new ConditionalSleep(random(1000,3000)) {
					@Override
					public boolean condition() throws InterruptedException {
						return myPlayer().isMoving();
					}
				}.sleep();
			}
			if(chest != null){
				if(myPlayer().getPosition().distance(chest.getPosition()) < 4 && myPlayer().isMoving()){
					sleep(random(100,250));
					return false;
				} 
				if(chest.interact("Use")){
					new ConditionalSleep(random(1000,3000)) {
						@Override
						public boolean condition() throws InterruptedException {
							return bank.isOpen();
						}
					}.sleep();
					log("Chest is open");
				}
			}
		}
		return false;
	}

The error occurs in the ConditionalSleep at "return bank.isOpen();"

Edited by Abuse
  • Like 1
Link to comment
Share on other sites

if (!getBank().isOpen()){
            getBank().open();
            new ConditionalSleep(5000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getBank().isOpen();
                }
            }.sleep();
        }

 

This indeed does solve the problem

 

Mind me asking how bank and getBank() differ from each other? Does it have something to do with syncing of the script thread and the OSBot thread?

 

edit: The same issue still persists with getBank()

 

 

 

Edited by Abuse
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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