Paint

Discussion in 'Archives' started by Nthn, Feb 20, 2009.

Thread Status:
Not open for further replies.
Paint
  1. Unread #1 - Feb 20, 2009 at 7:40 PM
  2. Nthn
    Joined:
    Dec 6, 2008
    Posts:
    35
    Referrals:
    0
    Sythe Gold:
    0

    Nthn Member

    Paint

    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.
     
  3. Unread #2 - Feb 20, 2009 at 8:46 PM
  4. Hey321
    Joined:
    Jul 30, 2007
    Posts:
    503
    Referrals:
    0
    Sythe Gold:
    0

    Hey321 Forum Addict

    Paint

    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
     
  5. Unread #3 - Feb 20, 2009 at 10:21 PM
  6. Nthn
    Joined:
    Dec 6, 2008
    Posts:
    35
    Referrals:
    0
    Sythe Gold:
    0

    Nthn Member

    Paint

    Finally got it working!

    Thanks alot. :)
     
  7. Unread #4 - Feb 20, 2009 at 10:46 PM
  8. Hey321
    Joined:
    Jul 30, 2007
    Posts:
    503
    Referrals:
    0
    Sythe Gold:
    0

    Hey321 Forum Addict

    Paint

    No problem, just trying to help :).

    ~Sandstorm
     
< Really Good Account Lvl 35 Use To Members Really Cool Look | [RSGP/SWAPS/WU] Selling Account Named 'HOT' 3 Letter name! [RSGP/SWAPS/WU] >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site