Jump to content
Sign in to follow this  
MarWo22

Stamina Potions

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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;
    }

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...