July 16, 20196 yr Hi! I can't get a joke-bot to accept past the 2nd trade window. Tried several different widgets, but it just won't work. Anybody know why? if (getTrade().isSecondInterfaceOpen()) { log("Second trade..."); if (getTrade().didOtherAcceptTrade() && !getTrade().getTheirOffers().isEmpty()) { RS2Widget acceptTrade = getWidgets().get(334, 25); if (acceptTrade.interact()) { tellJoke = true; return random(200, 300); } } } Also tried replacing: RS2Widget acceptTrade = getWidgets().get(334, 25); with: RS2Widget acceptTrade = getWidgets().getWidgetContainingText("Accept"); First time I try messing with Java, so probably something stupid I've missed 😉 Thanks!
July 16, 20196 yr I think there is no need to use widgets when accepting trades as API has implemented method. I just use trade.acceptTrade();
July 17, 20196 yr Author Yeah, solved it with a similar solution! Thanks! Do you happen to know how to insert an item in a trade? ---------------------------------------------------------------- public int onLoop() throws InterruptedException { if (trade.isCurrentlyTrading()) { if (trade.isFirstInterfaceOpen()) { trade.offer(2140,1); } (and a bit more code) ---------------------------------------------------------------- ^ does not work. It does however work if I place "trade.offer(2140,1);" right after the onLoop; ---------------------------------------------------------------- public int onLoop() throws InterruptedException { trade.offer(2140,1); if (trade.isCurrentlyTrading()) { if (trade.isFirstInterfaceOpen()) { } ---------------------------------------------------------------- ^ does work.
July 18, 20196 yr Hmm it seems to be working for me if I check getTrade().isFirstInterfaceOpen() before offering an item. can you print in the logger: log("Is first interface open? " + getTrade().isFirstInterfaceOpen() + "."); to confirm it's detecting that you're in the first interface?
July 18, 20196 yr Author 9 hours ago, Czar said: Hmm it seems to be working for me if I check getTrade().isFirstInterfaceOpen() before offering an item. can you print in the logger: log("Is first interface open? " + getTrade().isFirstInterfaceOpen() + "."); to confirm it's detecting that you're in the first interface? It works, just not always. And when it doesn't work, I have to restart client to get it working again. Read similar issues, but no solutions. It hovers over decline button when it doesn't work.
July 18, 20196 yr 7 hours ago, botelias said: It works, just not always. And when it doesn't work, I have to restart client to get it working again. Read similar issues, but no solutions. It hovers over decline button when it doesn't work. Alright is there any way you can replicate this bug or is it completely random? In any case I will have a chat with the scripters/devs and see if there's anything wrong ^^
August 24, 20196 yr Author On 7/18/2019 at 11:06 PM, Czar said: Alright is there any way you can replicate this bug or is it completely random? In any case I will have a chat with the scripters/devs and see if there's anything wrong ^^ Done more research now after coming back from vacation. The issue appears to be 100% random, and unrelated to account. Sometimes it works, sometimes it doesn't. If it however does work, it will keep working as long as client is running. Same if it doesn't work.
August 24, 20196 yr Well I will have to take a closer look at the trading and try to reproduce the bug in effort to send it to the devs ASAP so we can get it fixed. EDIT: Will be reviewing every possible variable that involves trading too. Edited August 24, 20196 yr by Czar
August 24, 20196 yr Author Tried simplifying the trade process as much as possible, removing everything that has to do with declining trade (empty window, slow trade, etc etc). Still hovers over "Decline".
August 24, 20196 yr Try and use widget id 334, 13 its the one that contains the action accept on the second trade screen. The other one that you are using contains only the text. Also I wrote up a basic trading handler here https://osbot.org/forum/topic/155996-trading-api-unpredictable/ Quick addition, to offer an item try and use this method. public boolean offerItem(String action, String itemName){ return getInventory().interact(action, itemName); } Edited August 24, 20196 yr by BravoTaco
Create an account or sign in to comment