Jump to content

Stamina Potions


Recommended Posts

Posted

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();
			}
		}

 

Posted (edited)

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 by Fruity
  • Like 1
  • 1 year later...
Posted
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

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...