May 25, 20205 yr 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(); }
May 25, 20205 yr Author 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, 20205 yr by Lol_marcus
May 25, 20205 yr 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
May 25, 20205 yr 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.
May 25, 20205 yr 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..
May 27, 20205 yr 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, 20205 yr by Ace99
Create an account or sign in to comment