Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Paint keeps disappearing

Featured Replies

hey guys, my paint keeps disapearing once it has started or done something in a method?

 

at the top of the method I have..

status = "Banking";

and once it starts doing that, on the screen the world banking changes colour and disappears for a short time?

 

worst thing is when I have my run time it also disappears

Can you show the relevant code, such as the onPaint method? If you don't want the code public you can PM one of us scripters.

  • Author

Can you show the relevant code, such as the onPaint method? If you don't want the code public you can PM one of us scripters.

  public void onPaint(Graphics2D graphics) {
    timeRan = System.currentTimeMillis() - this.timeBegan; 
    Graphics2D g = (Graphics2D) graphics;
    g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
        g.setColor(new Color(255, 255, 255));
        g.setFont(new Font("Arial", 0, 13));
        
        
    g.drawString(status, 200, 200);
    g.drawString("Time running: " + ft(timeRan), 553, 225);
    g.drawString("Tanned: " + made, 553, 245);
 
 
 
 
an example of a method..
public void walkbank() throws InterruptedException{
status = "Walking Bank";
    localWalker.walk(3276, 3176);
    sleep(3000);
    localWalker.walk(3271, 3168);
 
    }
 
 
it just greys out the status and removes the run time and amount made?

 

  public void onPaint(Graphics2D graphics) {
    timeRan = System.currentTimeMillis() - this.timeBegan; 
    Graphics2D g = (Graphics2D) graphics;
    g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
        g.setColor(new Color(255, 255, 255));
        g.setFont(new Font("Arial", 0, 13));
        
        
    g.drawString(status, 200, 200);
    g.drawString("Time running: " + ft(timeRan), 553, 225);
    g.drawString("Tanned: " + made, 553, 245);
 
 
 
 
an example of a method..
public void walkbank() throws InterruptedException{
status = "Walking Bank";
    localWalker.walk(3276, 3176);
    sleep(3000);
    localWalker.walk(3271, 3168);
 
    }
 
 
it just greys out the status and removes the run time and amount made?

 

 

I'm not entierly sure but 

sleep(3000);

should be changed into

sleep(random(3000); 


Or atleast i think it should be

  • Author

I'm not entierly sure but 

sleep(3000);

should be changed into

sleep(random(3000); 


Or atleast i think it should be

chaning that wouldnt work as using random picks a random number between the two numbers you give, as you only give 3000, it wouldnt work.

Graphics2D g = (Graphics2D) graphics;

 

No need to cast here, since the parameter already uses Graphics2D.

  • Author
Graphics2D g = (Graphics2D) graphics;

No need to cast here, since the parameter already uses Graphics2D.

 

 

anyway to fix my problem tho?

 

trying to make a new script now and itsn ot showing any of the paint whatso ever..

 

nothing in the main loop either, just a return statement?

anyway to fix my problem tho?

 

trying to make a new script now and itsn ot showing any of the paint whatso ever..

 

nothing in the main loop either, just a return statement?

 

Post your whole script here or PM me it. 

  • Author

Post your whole script here or PM me it. 

its literally this...

 
import java.awt.*;
import java.text.DecimalFormat;
import java.util.concurrent.TimeUnit;
 
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
 
@ScriptManifest(name = "KaramjaFisher", author = "Scriptation", version = 1.0, info = "Fishes & Banks", logo = "") 
public class Main extends Script{
 
 
public String status;
private long timeBegan;
private long timeRan;
 
 
    @Override
    public void onStart() {
    timeBegan = System.currentTimeMillis();
    log("Starting!");
    }
    
    @Override
    public void onExit() {
    log("Ending");
    }
 
 
    @Override
    public int onLoop() throws InterruptedException {
 
 
        return 100; 
    }   
    
    
    private String ft(long duration) 
{
String res = "";
long days = TimeUnit.MILLISECONDS.toDays(duration);
long hours = TimeUnit.MILLISECONDS.toHours(duration)
- TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
- TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
.toHours(duration));
long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
.toMinutes(duration));
if (days == 0) {
res = (hours + ":" + minutes + ":" + seconds);
} else {
res = (days + ":" + hours + ":" + minutes + ":" + seconds);
}
return res;
    
 
    @Override
    public void onPaint(Graphics2D g) {
    timeRan = System.currentTimeMillis() - this.timeBegan;
    Graphics2D gr = g;
    g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
        g.setColor(new Color(255, 255, 255));
        g.setFont(new Font("Arial", 0, 13));
        
        
    g.drawString(status, 200, 200);
    g.drawString("Time running: " + ft(timeRan), 553, 225);
 
    }
}
 

    @Override
    public void onPaint(Graphics2D g) {
    timeRan = System.currentTimeMillis() - this.timeBegan;
    Graphics2D gr = g;
    g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
        g.setColor(new Color(255, 255, 255));
        g.setFont(new Font("Arial", 0, 13));
        
        
    g.drawString(status, 200, 200);
    g.drawString("Time running: " + ft(timeRan), 553, 225);
 
    }
}

 

 

Looks fine.. Tho in this particular case, 'status' is never initialized, so its probably throwing nullpointers unless drawString has some internal checks. If you did initialize it, show us the code you use to change around the status value.. Maybe there's an issue there somewhere.

 

chaning that wouldnt work as using random picks a random number between the two numbers you give, as you only give 3000, it wouldnt work.

 

 

Hey, sorry i can't help with your paint issue but i may be able to help with the random.

 

 

there are two variations of random. The first being 

random(int x, int y)

 and the second

random(int x)

the second returns a random number between 0 and x (exlusive)

hope this helps tongue.png

Edited by baseball_260

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.