Reid Posted March 15, 2014 Share Posted March 15, 2014 (edited) Meant for new scripters. If you're going to hate go away. Enjoy. package org.purplekush.api; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import org.osbot.script.Script; import org.osbot.script.rs2.skill.Skill; /** * * @author Reid (PurpleKush) * @version 0.1 */ public class AccuXP { public static String status; private Script s; private static long startTime; private static int skillToTrackXP; private static Skill skillTracking; public AccuXP(Script s) { this.s = s; } /** * Starts Timer */ public void startTimer() { startTime = System.currentTimeMillis(); } /** * What skill you would like to track * @param skill */ public void trackXPForSkill(Skill skill) { skillToTrackXP = s.client.getSkills().getExperience(skill); skillTracking = skill; } /** * Paint data to canvas * @param g */ public void calculatePaint(Graphics g) { int totalXP = s.client.getSkills().getExperience(skillTracking) - skillToTrackXP; long millis = System.currentTimeMillis() - startTime; int xpPH = (int) (totalXP * 3600000.0D / millis); g.setColor(Color.WHITE); g.setFont(new Font("Myriad Pro", Font.PLAIN, 16)); g.drawString("Time Running : "+ getFormattedTime(System.currentTimeMillis()- startTime), 7, 275); g.drawString("Status : " + status, 7, 295); g.drawString("XP P/H : " + xpPH, 7, 315); g.drawString("XP Gained : " + totalXP, 7, 335); } private String getFormattedTime(final long timeMilliseconds) { final StringBuilder b = new StringBuilder(); final long runtime = timeMilliseconds; final long totalSecs = runtime / 1000; final long totalMins = totalSecs / 60; final long totalHours = totalMins / 60; final int seconds = (int) totalSecs % 60; final int minutes = (int) totalMins % 60; final int hours = (int) totalHours % 60; if (hours < 10) { b.append("0"); } b.append(hours); b.append(":"); if (minutes < 10) { b.append("0"); } b.append(minutes); b.append(":"); if (seconds < 10) { b.append("0"); } b.append(seconds); return b.toString(); } } Usage: AccuXP xp = new AccuXP(this); public void onStart(){ xp.startTimer(); xp.trackXPForSkill(Skill.COOKING); } public void onPaint(Graphics g){ xp.calculatePaint(g); } Edited March 15, 2014 by PurpleKush Link to comment Share on other sites More sharing options...
Swift Posted March 15, 2014 Share Posted March 15, 2014 Not to be rude or anything. But what's so special about this? Link to comment Share on other sites More sharing options...
Reid Posted March 15, 2014 Author Share Posted March 15, 2014 Not to be rude or anything. But what's so special about this? Did i say anything is special? I made it for myself to use and decided to post so other people can also use and it can possibly help new scripters.... fkin anjew 1 Link to comment Share on other sites More sharing options...
Joseph Posted March 15, 2014 Share Posted March 15, 2014 Not to be rude or anything. But what's so special about this? its isnt really to special, especially for people who know how to code this. This is really meant for those who have trouble with painting graphic on script. They could use this to study, learn, and experiment. 1 Link to comment Share on other sites More sharing options...
Reid Posted March 15, 2014 Author Share Posted March 15, 2014 its isnt really to special, especially for people who know how to code this. This is really meant for those who have trouble with painting graphic on script. They could use this to study, learn, and experiment. +1 which is why i posted. Link to comment Share on other sites More sharing options...
Swift Posted March 15, 2014 Share Posted March 15, 2014 AccuXP Link to comment Share on other sites More sharing options...
Swizzbeat Posted March 15, 2014 Share Posted March 15, 2014 Nice little snippet bud, should help out the newbies 1 Link to comment Share on other sites More sharing options...
GoldenGates Posted March 15, 2014 Share Posted March 15, 2014 Nice little snippet bud, should help out the newbies So you found it helpful right? jk 2 Link to comment Share on other sites More sharing options...
Dog_ Posted March 15, 2014 Share Posted March 15, 2014 Not to be rude or anything. But what's so special about this?It's a timer for experience, it will track the experience so you don't have to. 1 Link to comment Share on other sites More sharing options...
Han Posted March 15, 2014 Share Posted March 15, 2014 Nice to see you helping the fellow scripters, nice snippet to have! 1 Link to comment Share on other sites More sharing options...
Nezz Posted March 16, 2014 Share Posted March 16, 2014 I understand that this is used to track experience and whatnot, but why not just use OSBot's experienceTracker..? Link to comment Share on other sites More sharing options...
Dog_ Posted March 16, 2014 Share Posted March 16, 2014 I understand that this is used to track experience and whatnot, but why not just use OSBot's experienceTracker..?he probably wasn't aware that it existed or he just wanted to make his own Link to comment Share on other sites More sharing options...
Reid Posted March 16, 2014 Author Share Posted March 16, 2014 I understand that this is used to track experience and whatnot, but why not just use OSBot's experienceTracker..? Didn't even know this existed :p Thanks for letting me know Link to comment Share on other sites More sharing options...
lare96 Posted March 16, 2014 Share Posted March 16, 2014 this actually helped me out a bit with the paint stuff, so thanks Link to comment Share on other sites More sharing options...
Nezz Posted March 16, 2014 Share Posted March 16, 2014 Didn't even know this existed Thanks for letting me know No problem. :P Link to comment Share on other sites More sharing options...