Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • EXP Popups


    Recommended Posts

    Hey guys! I just implemented this into my scripts and figured I'd share it for anyone who likes this sort of thing. This small bit of code will add EXP Popups to your script:





    // EXP Popup variables
    private boolean expShow = true; // If true, EXP popups are enabled
    private boolean expPaint = false; // If true, the EXP popup draws to the screen
    private long expStart = 0L; // This is used to determine when the last EXP gain happened
    private int expGained = 0; // This tracks the EXP gain to display
    private int expTotal = 0; // This tracks our last total exp so that we can detect when our new total exp changes
    private double expX = 270; // This is the X coordinate of the EXP popup (horizontal alignment - never changes)
    private double expY = 160; // This is the Y coordinate of the EXP popup (by decrementing, we can make the popup float vertically)
    // Returns total EXP gained
    public int getTotalExp() {
        Skill[] skills = Skill.values();
        int exp = 0;
        for (Skill skill : skills)
            exp += getSkills().getExperience(skill);
        return exp;
    // Draw script info to the screen
    public void onPaint(Graphics g) {
        // Display EXP popups if they are enabled
        if(expShow) {
            // If this is the first iteration of Paint (ie. script just started), set EXP total to current total.
            if(expTotal == 0)
                expTotal = getTotalExp();
            // Show EXP Popup
            if (expPaint) {
                // If it has been less than 3 seconds since our last EXP gain, display the popup
                if (System.currentTimeMillis() - expStart <= 3000 && expGained != 0) {
                    String gained = "+" + expGained + " EXP";
                    g.drawString(gained, (int)expX + 1, (int)expY + 1);
                    g.drawString(gained, (int)expX, (int)expY);
                    expY -= 0.5;
                } else {
                    // Otherwise reset the popup
                    expY = 160;
                    expPaint = false;
            // New exp gain detected
            if (getTotalExp() != expTotal) {
                expPaint = true;
                expStart = System.currentTimeMillis();
                expGained = getTotalExp() - expTotal;
                expTotal = getTotalExp();
                expY = 160;
    Edited by Zenarchist
    Link to comment
    Share on other sites

    On 9/30/2018 at 2:34 AM, Infidel said:

    Customization. Can be used for way more than just experience. Get creative. =D

    ^ this :) with a few edits you can display whatever your heart desires :D 

    Edited by Zenarchist
    Link to comment
    Share on other sites

    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

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.