Jump to content

How to track XP drops?


maximiliano1

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

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