Jump to content

trying to make my script eat while it is webwalking?


Recommended Posts

Posted

So to start with, here is me getting the dynamic skill level:

public int currentHP(int currentHealth){
        currentHealth = getSkills().getDynamic(Skill.forName("HITPOINTS"));
        return currentHealth;
    }

    int currentHealth = 0;

This is me creating a loop while it is webwalking so that it eats when health is 6 or below:

else if(downLadder.contains(myPlayer()) && !getInventory().isFull()){
            getWalking().webWalk(safeSpot);
            while(getWalking().webWalk(safeSpot)){
                if(currentHP(currentHealth) >= 6 && getInventory().contains("Trout")){
                    getInventory().interact("Trout", "Eat");
                }
            }
        }

 

It doesn't actually eat any food regardless of how much health my player has. Any idea where i'm going wrong?

Cheers in advance guys!

Posted

Try checking this out

 

WalkingEvent myEvent = new WalkingEvent(new Position(1, 2, 3)); //making the event
myEvent.setMinDistanceThreshold(0); 
myEvent.setEnergyThreshold(47);
myEvent.setBreakCondition(new Condition() {
    @Override
    public boolean evaluate() {
        return myPlayer().isUnderAttack();
    } //change to if health below x
});
execute(myEvent); //executing the event

 

 

  • Like 2

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...