Loki874 Posted August 16, 2019 Posted August 16, 2019 (edited) Hi, I have the following piece of code: inventory.getItem("Tuna").interact("Eat") and sometimes the bot hangs up for a few seconds (looks like 7 seconds) and displays the following error into the logger: [ERROR][Bot #1][08/16 08:43:25 AM]: Inventory widget is null, trying to guess position. This is causing the bot to sometimes die as he does not eat on time. Any suggestions? EDIT: I could confirm there are still Tunas left in the inventory Edited August 16, 2019 by Loki874
Derogan Posted August 16, 2019 Posted August 16, 2019 Maybe the inventory tab is not open when this happens?
Hybris Posted August 16, 2019 Posted August 16, 2019 3 hours ago, Loki874 said: Hi, I have the following piece of code: inventory.getItem("Tuna").interact("Eat") and sometimes the bot hangs up for a few seconds (looks like 7 seconds) and displays the following error into the logger: [ERROR][Bot #1][08/16 08:43:25 AM]: Inventory widget is null, trying to guess position. This is causing the bot to sometimes die as he does not eat on time. Any suggestions? EDIT: I could confirm there are still Tunas left in the inventory Open the inventory before trying to eat
Leetkiss Posted August 16, 2019 Posted August 16, 2019 4 hours ago, Loki874 said: [ERROR][Bot #1][08/16 08:43:25 AM]: Inventory widget is null, trying to guess position. This error sometimes occurs in re-sizable mode - set your bot to fixed screen mode.
Loki874 Posted August 17, 2019 Author Posted August 17, 2019 FIXED Looks like it was happening occasionally when the inventory tab wasn't available (like when the bank interface is open) if(tabs.getTabWidget(Tab.INVENTORY) != null && !Tab.INVENTORY.isDisabled(bot)) { inventory.getItem("Tuna").interact("Eat") }
Gunman Posted August 17, 2019 Posted August 17, 2019 17 minutes ago, Loki874 said: FIXED Looks like it was happening occasionally when the inventory tab wasn't available (like when the bank interface is open) if(tabs.getTabWidget(Tab.INVENTORY) != null && !Tab.INVENTORY.isDisabled(bot)) { inventory.getItem("Tuna").interact("Eat") } Download the dev build 2.5.55 It can now tell where items are in inventory without it being open according to Patrick's change log.
liverare Posted August 17, 2019 Posted August 17, 2019 Item tuna = inventory.getItem("Tuna"); if (tuna != null) { tuna.interact("Eat"); }
Loki874 Posted August 17, 2019 Author Posted August 17, 2019 55 minutes ago, liverare said: Item tuna = inventory.getItem("Tuna"); if (tuna != null) { tuna.interact("Eat"); } 6 hours ago, Gunman said: Download the dev build 2.5.55 It can now tell where items are in inventory without it being open according to Patrick's change log. Will try it thx 1