• Log in or sign up for an account here: https://www.sythe.org/login

Paint

Status
Not open for further replies.

Nthn

Member
Joined
Dec 6, 2008
Sythe Gold
0
Messages
35
Can anybody teach me how to add paint to a script?

I've been looking over a few other scripts that have paint and I just can't seem to get it to work on mine haha. Only want the paint to show the name of the script & how long it has been running.

I can't offer you a payment but I would be incredibly thankful if you could tell me what to do.

Thanks.
 
Code:
    public void onRepaint(Graphics g) {
        g.setColor(Color.RED);
        g.drawString("Yanille Rune Essence Miner", 260, 20);
        g.drawString("Loads: " + loads + "   Ess Mined: " + mined, 260, 38);
        if (usePrice)
            g.drawString("Profit: " + price * mined + "   " + price
                    + " gp each.", 260, 56);
    }

public void onRepaint(Graphics g) {} is what colors everything on screen.

g.setColor sets the color. I don't know what all the colors are, but you can set multiple colors (paint one thing, then change color, paint another, etc.).

g.drawString actually draws the string on the screen. The coordinates at the end are where you want the paint to end up.

For you, you'd probably want something like this:

Code:
    public void onRepaint(Graphics g) {
        g.setColor(Color.RED);
        g.drawString("My Script name Here", 260, 20);
        g.drawString("Ran for: " However you tell how long it's been, 260, 38);
    }

To figure out how long it's run for, Tenac's Guild Miner uses this method:

Code:
            if(startTime == 0)
                startTime = System.currentTimeMillis();

            long millis = System.currentTimeMillis() - startTime;
            long hours = millis / (1000 * 60 * 60);
            millis -= hours * (1000 * 60 * 60);
            long minutes = millis / (1000 * 60);
            millis -= minutes * (1000 * 60);
            long seconds = millis / 1000;
            g.drawString("Running for " + hours + ":" + minutes + ":" + seconds, 260, 38);

Starttime is declared as a public integer at the start of the script I BELIEVE, but I'm not the best at RSBot coding. Hoping I got this right lol.

Hope this helps!

~Sandstorm
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top