March 30, 20187 yr Im trying to make a script where it takes stamina potions every two minutes. I've come up with this but it doesnt work. It keeps drinking the potions. Any idea why? public static long staminaPotionIntake = 0; public static long staminaPotionDuration = System.currentTimeMillis() - staminaPotionIntake; public static String[] staminaNames = {"Stamina potion(4)", "Stamina potion(3)", "Stamina potion(2)", "Stamina potion(1)"}; public Banking(Script sI) throws InterruptedException { if(staminaPotionDuration > 120000) { if(sI.getInventory().contains(staminaNames)) { sI.getInventory().interact("Drink", staminaNames); staminaPotionIntake = System.currentTimeMillis(); } }
March 30, 20187 yr looks as though you're checking the duration once oustside the method so only ever updated once? Also you can check if stamina potion is active via configs: public boolean isStaminaPotionActive() { return getConfigs().get(638) > 0; } Edited March 30, 20187 yr by Fruity
February 28, 20205 yr On 3/30/2018 at 10:02 PM, Fruity said: looks as though you're checking the duration once oustside the method so only ever updated once? Also you can check if stamina potion is active via configs: public boolean isStaminaPotionActive() { return getConfigs().get(638) > 0; } Thanks Big Boss. For those wondering, config changed to: 1575. Following code works as of date: public boolean isStaminaPotionActive() { return getConfigs().get(1575) > 0; }
Create an account or sign in to comment