IcCookies 24 Share Posted October 18, 2015 Hello everyone, How would I add an xp tracker to my bot? Right now i have: public int start(){ return getSkillTracker().start(Skill.MINING); } public long stat(){ return getSkillTracker().getGainedExperience(Skill.MINING); } but it says it can't return a void result. I am a beginner scripter and would gladly accept some help please! Link to comment Share on other sites More sharing options...
Diddy 264 Share Posted October 18, 2015 public void onPaint(Graphics2D g) { g.setFont(font);g.setColor(Color.BLACK); g.drawString("" +getSkillTracker().getGainedExperience(Skill.MINING), x, y); } /* This is to paint it on the client screen */ IcCookies 1 Link to comment Share on other sites More sharing options...
RealEngine 24 Share Posted October 18, 2015 private int xpBegan; private int xp; onstart xpBegan = getSkills().getExperience(Skill.ATTACK) + getSkills().getExperience(Skill.STRENGTH) + getSkills().getExperience(Skill.DEFENCE) + getSkills().getExperience(Skill.HITPOINTS); onpaint xp = (getSkills().getExperience(Skill.ATTACK) + getSkills().getExperience(Skill.STRENGTH) + getSkills().getExperience(Skill.DEFENCE) + getSkills().getExperience(Skill.HITPOINTS)) - xpBegan; int xph = (int) (xp / ((timeRan) / 3600000.0D)); now draw it g.drawString("xp = " + NumberFormat.getNumberInstance(Locale.US).format(xp), 345 + 2, 341 + 30); g.drawString("xph = " + NumberFormat.getNumberInstance(Locale.US).format(xph), 345 + 2, 341 + 48); Link to comment Share on other sites More sharing options...
Dreamlicker 749 Share Posted October 19, 2015 Hello everyone, How would I add an xp tracker to my bot? Right now i have: public int start(){ return getSkillTracker().start(Skill.MINING); } public long stat(){ return getSkillTracker().getGainedExperience(Skill.MINING); } but it says it can't return a void result. I am a beginner scripter and would gladly accept some help please! Change start from int to void. That method probably doesn't return an int. Just run the method without any return Link to comment Share on other sites More sharing options...
IcCookies 24 Author Share Posted October 19, 2015 (edited) I put in g.drawString("Mining exp: " + getSkillTracker().getGainedExperience(Skill.MINING), 5, 85); and all it does is print out the total xp that I have!!! Edited October 19, 2015 by IcCookies Link to comment Share on other sites More sharing options...
RealEngine 24 Share Posted October 19, 2015 I put in g.drawString("Mining exp: " + getSkillTracker().getGainedExperience(Skill.MINING), 5, 85); and all it does is print out the total xp that I have!!! then just forgot that method and use the one I have pasted above and replace the combat stats with the mining stat. IcCookies 1 Link to comment Share on other sites More sharing options...
Dreamlicker 749 Share Posted October 19, 2015 I put in g.drawString("Mining exp: " + getSkillTracker().getGainedExperience(Skill.MINING), 5, 85); and all it does is print out the total xp that I have!!! This happens if you start the script without being logged in to the client, as it starts the skill tracker on script start if you put it in onStart() IcCookies 1 Link to comment Share on other sites More sharing options...
Nuclear Nezz 1996 Share Posted October 20, 2015 The original problem you were asking about: public int start(){ return getSkillTracker().start(Skill.MINING); } getSkillTracker().start is a void method, it doesn't return anything. You're trying to return a void method, so just remove the return and change the method to a void. public void start(){getSkillTracker().start(Skill.MINING); } Link to comment Share on other sites More sharing options...
IcCookies 24 Author Share Posted October 20, 2015 (edited) The original problem you were asking about: public int start(){ return getSkillTracker().start(Skill.MINING); } getSkillTracker().start is a void method, it doesn't return anything. You're trying to return a void method, so just remove the return and change the method to a void. public void start(){getSkillTracker().start(Skill.MINING); } So can I do this or is there still a problem: public void onPaint(Graphics2D g) { g.drawString("Mining exp: " + xp, 5, 85); } public void xp(){ getSkillTracker().start(Skill.MINING); } Edited October 20, 2015 by IcCookies Link to comment Share on other sites More sharing options...
Nuclear Nezz 1996 Share Posted October 20, 2015 So can I do this or is there still a problem: public void onPaint(Graphics2D g) { g.drawString("Mining exp: " + xp, 5, 85); } public void xp(){ getSkillTracker().start(Skill.MINING); } I would suggest you learn Java before you try to learn how to script. It'll make the process go much smoother. Link to comment Share on other sites More sharing options...
Recommended Posts