Abuse Posted February 11, 2016 Share Posted February 11, 2016 (edited) 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 February 11, 2016 by Abuse 1 Link to comment Share on other sites More sharing options...
Chris Posted February 11, 2016 Share Posted February 11, 2016 if (!getBank().isOpen()){ getBank().open(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } Link to comment Share on other sites More sharing options...
Abuse Posted February 11, 2016 Author Share Posted February 11, 2016 (edited) 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 February 11, 2016 by Abuse Link to comment Share on other sites More sharing options...
Khaleesi Posted February 12, 2016 Share Posted February 12, 2016 I'm having the same issue, I made a nother bug report about this 2 days ago People getting pretty pissed off by this issue 1 Link to comment Share on other sites More sharing options...
Abuse Posted February 13, 2016 Author Share Posted February 13, 2016 @@Khaleesi Does it also freeze your script until you pause/restart it? If so, I made a workaround by pausing/resuming the script in a separate thread every x minutes getBot().getScriptExecutor().pause(); and getBot().getScriptExecutor().resume(); Link to comment Share on other sites More sharing options...