Lol_marcus Posted May 25, 2020 Share Posted May 25, 2020 Hi, Is there any reason why it's not sipping a pot when my run energy goes below 30%? Ignore the fact that I only have a 4 dose on there, I'll use an array later to add all doses later. public void drinkPots() throws InterruptedException { if (settings.getRunEnergy() < 30) { getInventory().interact("Drink", "Energy potion(4)"); sleep(random(50, 500)); } new ConditionalSleep(4000, 200) { @Override public boolean condition() { return (settings.getRunEnergy() > 90); } }.sleep(); } Quote Link to comment Share on other sites More sharing options...
D9BLADEE Posted May 25, 2020 Share Posted May 25, 2020 You tried getSettings() rather than settings? That works for me Quote Link to comment Share on other sites More sharing options...
Lol_marcus Posted May 25, 2020 Author Share Posted May 25, 2020 (edited) 3 minutes ago, D9BLADEE said: You tried getSettings() rather than settings? That works for me Lemme give that a go. I'll report back. It worked. Fancy that. ^^ Thanks. I wonder why settings. didn't work. o_O Edited May 25, 2020 by Lol_marcus Quote Link to comment Share on other sites More sharing options...
D9BLADEE Posted May 25, 2020 Share Posted May 25, 2020 18 minutes ago, Lol_marcus said: Lemme give that a go. I'll report back. It worked. Fancy that. ^^ Thanks. I wonder why settings. didn't work. o_O magic m8 Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted May 25, 2020 Share Posted May 25, 2020 With calling settings you are calling the variable itself with getSettings() you are calling a getter that may be doing more than just returning the variable itself. In most cases calling just settings will work but depending on when and where you are calling the settings variable it’s context could possibly not be the current bot context so it is unable to accurately retrieve the information needed while not throwing any errors. To verify this, print what the current value of that call is, to the console. 2 Quote Link to comment Share on other sites More sharing options...
D9BLADEE Posted May 25, 2020 Share Posted May 25, 2020 8 minutes ago, BravoTaco said: With calling settings you are calling the variable itself with getSettings() you are calling a getter that may be doing more than just returning the variable itself. In most cases calling just settings will work but depending on when and where you are calling the settings variable it’s context could possibly not be the current bot context so it is unable to accurately retrieve the information needed while not throwing any errors. To verify this, print what the current value of that call is, to the console. i knew that.. Quote Link to comment Share on other sites More sharing options...
Ace99 Posted May 27, 2020 Share Posted May 27, 2020 (edited) On 5/25/2020 at 5:32 PM, Lol_marcus said: I'll use an array later to add all doses later. This is not related to your actual question, just a suggestion: Try using a Filter<Item> to grab all the energy pots at various doses, if you haven't already Edited May 27, 2020 by Ace99 Quote Link to comment Share on other sites More sharing options...