Ragboys is back Posted July 23, 2018 Share Posted July 23, 2018 (edited) I know there are tons of scripts like feather buying already, but I usually like to make my own scripts to improve my programming skills/get more used to the API. What my script is supposed to do: - Buy feather pack only if there is over 95 packs in the shop; (working) - Open all the packs in the inventory when the inventory is full; (need help) To open the packs, I'm checking if the inventory is full. If it its, it'll open the packs, but once one pack is open, the inventory is not full anymore, so it'll buy more packs until the inventory is full again. I also tried checking if my inventory had over 'x' packs, but that's not working either, because it's pretty much the same logic above. Let's say it'll open packs once my inventory contains 25 or more (>=25) packs. Once one pack is open, the inventory will contain 24 packs and it will buy more packs, not opening the remaining. How could I fix this? What kind of condition should I check? Should I make my own void method to open 'x' packs? If so, how to do it? Thanks in advance. Edited July 23, 2018 by Ragboys is back Quote Link to comment Share on other sites More sharing options...
Hannibal_ Posted July 23, 2018 Share Posted July 23, 2018 10 minutes ago, Ragboys is back said: I know there are tons of scripts like feather buying already, but I usually like to make my own scripts to improve my programming skills/get more used to the API. What my script is supposed to do: - Buy feather pack only if there is over 95 packs in the shop; (working) - Open all the packs in the inventory when the inventory is full; (need help) To open the packs, I'm checking if the inventory is full. If it its, it'll open the packs, but once one pack is open, the inventory is not full anymore, so it'll buy more packs until the inventory is full again. I also tried checking if my inventory had over 'x' packs, but that's not working either, because it's pretty much the same logic above. Let's say it'll open packs once my inventory contains 25 or more (>=25) packs. Once one pack is open, the inventory will contain 24 packs and it will buy more packs, not opening the remaining. How could I fix this? What kind of condition should I check? Should I make my own void method to open 'x' packs? If so, how to do it? Thanks in advance. you pathing to bank when invent is full? Quote Link to comment Share on other sites More sharing options...
D Bolter Posted July 23, 2018 Share Posted July 23, 2018 change the state to opening feather packs once inventory is full, only exit this state if there are no more feather packs to open. Quote Link to comment Share on other sites More sharing options...
Juggles Posted July 23, 2018 Share Posted July 23, 2018 Sleep condition until out of feather packs Quote Link to comment Share on other sites More sharing options...
IDontEB Posted July 23, 2018 Share Posted July 23, 2018 53 minutes ago, Juggles said: Sleep condition until out of feather packs this and use System.exit(0) if it breaks out of the sleep and there's still packs unopened. 1 Quote Link to comment Share on other sites More sharing options...
dreameo Posted July 23, 2018 Share Posted July 23, 2018 Once you open a feather pack, yes the condition is no longer true that inventory is full, however you are still inside the code block. The code block will execute everything inside of it (that should be executed), it wont just exit because the condition changed. If you have it written so that it opens everything (example: iterate through all items and open), then you wouldn't be facing this problem. Quote Link to comment Share on other sites More sharing options...