Yellows Posted May 8, 2016 Share Posted May 8, 2016 g.drawString("" + getExperienceTracker().getGainedXPPerHour(Skill.ATTACK), 346, 415); This gets the experience of one skill, but I want multiple skills in paint, so I tried g.drawString("" + getExperienceTracker().getGainedXPPerHour(Skill.ATTACK) + getExperienceTracker().getGainedXPPerHour(Skill.DEFENCE), 346, 415); But it doesn't start on 0 and it starts at 9000 and something. Quote Link to comment Share on other sites More sharing options...
IHB Posted May 8, 2016 Share Posted May 8, 2016 (edited) g.drawString("Strength XP gained: " + xpGainedstr + " " + beginningstrLevel + " / " + currentstrLevel + " (+" + levelsstrGained + ")", 10, 285); g.drawString("Attack XP gained: " + xpGainedatt + " " + beginningattLevel + " / " + currentattLevel + " (+" + levelsattGained + ")", 10, 300); This is what I use for something with more than 1 skill Edited May 8, 2016 by IHB Quote Link to comment Share on other sites More sharing options...
Lemons Posted May 8, 2016 Share Posted May 8, 2016 (edited) g.drawString("" + getExperienceTracker().getGainedXPPerHour(Skill.ATTACK), 346, 415); This gets the experience of one skill, but I want multiple skills in paint, so I tried g.drawString("" + getExperienceTracker().getGainedXPPerHour(Skill.ATTACK) + getExperienceTracker().getGainedXPPerHour(Skill.DEFENCE), 346, 415); But it doesn't start on 0 and it starts at 9000 and something. This is due to the String thinking + is concatenation, and you figuring the 2 Integers would be added. How java reads this is: "" + "900" + "0" Where you want code like: Integer totalXpPerHour = getExperienceTracker().getGainedXPPerHour(Skill.ATTACK) + getExperienceTracker().getGainedXPPerHour(Skill.DEFENCE); g.drawString("" + totalXpPerHour, 346, 415); You could also do it like this, but I feel it is messier: g.drawString("" + (getExperienceTracker().getGainedXPPerHour(Skill.ATTACK) + getExperienceTracker().getGainedXPPerHour(Skill.DEFENCE)), 346, 415); Note the parenthesis around the addition parts, then the "" + to make it a String. Edited May 8, 2016 by Lemons 3 Quote Link to comment Share on other sites More sharing options...