Jump to content

Experience Tracker


Recommended Posts

Posted

Well, tried looking to better paint methods (ExperienceTracker api), and I'm not the best @ scripting and Java but I'm positive I did this right...

 

I've already defined ExperienceTracker as: (Don't criticize my naming)

ExperienceTracker  xpTrack= new ExperienceTracker();

So in my onStart method, I have this:

xpTrack.start(Skill.MINING);

Then my paint, as well, these don't even show up:

g.drawString("Experience: " + xpTrack.getGainedXP(Skill.MINING) + " (" + xpTrack.getGainedXPPerHour(Skill.MINING) + ")", 15, 101);
g.drawString("Level: " + this.beginningLevel + " (" + xpTrack.getGainedLevels(Skill.MINING) + ")", 15, 115);

And I wasn't getting any errors... but the log for when I started the script:

[INFO][Bot #1][08/13 07:31:44 PM]: Thanks for using WWFMiner!
[INFO][Bot #1][08/13 07:31:44 PM]: Error in script onExit(): WWFMiner
[INFO][Bot #1][08/13 07:31:44 PM]: Script WWFMiner has exited!

Posted (edited)

I'm guessing you need to call

 

xpTrack.exchangeContext(this);

 

Also you should post these into the scripting help section so others (ie starting scripters) can benefit from this too

 

 

Oop, true. I'll move it there, and I'll see if that is the problem.

 

noobs

 

initialize your global instance using the getter method from method provider do it on the onStart

ExperienceTracker  xpTrack;

onStart() {
this.xpTrack = getExperienceTracker();
}
Edited by jos3dpay
  • Like 3

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