Jump to content

How to track XP drops?


Recommended Posts

Posted (edited)

Maybe you can store current xp in a global variable, and then check if your variable is different from current xp

public class MyAwesomeBot extends Script {

    private int currentExp;
    
    @Override
    public void onStart() {
        currentExp = getExperienceTracker().getGainedXP(Skill.STRENGTH);
    }

    @Override
    public int onLoop() {
        if(currentExp != getExperienceTracker().getGainedXP(Skill.STRENGTH)){
            log("Exp changed!");
            currentExp = getExperienceTracker().getGainedXP(Skill.STRENGTH);
        }
        return 500;
    }
}

 

Edited by Heiz
identation
Posted
On 9/21/2021 at 9:45 PM, ProjectPact said:

Game ticks occur every ~600 ms

I've tested as you advised by computing the xp change directly through the onGameTick and then computing via ExperienceTracker, but still after capturing the video and checking the timings, it seems that ExperienceTracker lags behind couple ticks compared to the actual xp change.

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