iJodix Posted March 5, 2015 Share Posted March 5, 2015 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" }); } } Quote Link to comment Share on other sites More sharing options...
Kristoffer OSBot Posted March 5, 2015 Share Posted March 5, 2015 (edited) 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. Edited March 5, 2015 by Kristoffer OSBot Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted March 5, 2015 Share Posted March 5, 2015 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? Quote Link to comment Share on other sites More sharing options...
iJodix Posted March 5, 2015 Author Share Posted March 5, 2015 (edited) thats because de decompiled a .class fiel fo someone Not sure what you are trying to do here, why a widget check? To check if the bank interface is open. bank.isOpen(), bank.depositAll() none of them works. Edited March 5, 2015 by iJodix Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 5, 2015 Share Posted March 5, 2015 (edited) 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 March 5, 2015 by josedpay Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted March 5, 2015 Share Posted March 5, 2015 To check if the bank interface is open if(bank.isOpen()){ //bank }else{ bank.open() } Is easier? Quote Link to comment Share on other sites More sharing options...
iJodix Posted March 5, 2015 Author Share Posted March 5, 2015 thats because de decompiled a .class fiel fo someone Not really decompiling, if i struggle with something, i just get reference from codes posted to pastebin. Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted March 5, 2015 Share Posted March 5, 2015 Not really decompiling, if i struggle with something, i just get reference from codes posted to pastebin. Why use this then: new String[] { "Bones" } That only gets generated by JAD decompiler xD Just use "Bones" instead? Quote Link to comment Share on other sites More sharing options...
iJodix Posted March 5, 2015 Author Share Posted March 5, 2015 Why use this then: new String[] { "Bones" } That only gets generated by JAD decompiler xD Just use "Bones" instead? I guess whoever posted those scripts on pastebin got em by decompiling. And thanks, i will. Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted March 5, 2015 Share Posted March 5, 2015 (edited) I guess whoever posted those scripts on pastebin got em by decompiling. And thanks, i will. haha could be 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 March 5, 2015 by Khaleesi Quote Link to comment Share on other sites More sharing options...
Developer Maxi Posted March 5, 2015 Developer Share Posted March 5, 2015 To check if the bank interface is open. bank.isOpen(), bank.depositAll() none of them works. I don't see why not. I've been running a NON ported script that runs fine, banking, interacting etc. Quote Link to comment Share on other sites More sharing options...
iJodix Posted March 5, 2015 Author Share Posted March 5, 2015 (edited) I don't see why not. I've been running a NON ported script that runs fine, banking, interacting etc. 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 March 5, 2015 by iJodix Quote Link to comment Share on other sites More sharing options...
Developer Maxi Posted March 5, 2015 Developer Share Posted March 5, 2015 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(); } Quote Link to comment Share on other sites More sharing options...