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.

Picture help

Featured Replies

Hi, so i know how to add the picture t the script logo.

But how does one make the picture appear on screen over chatbox, Can't seem to work that out :?

 

Thanks

15 minutes ago, scriptersteve said:

Hi, so i know how to add the picture t the script logo.

But how does one make the picture appear on screen over chatbox, Can't seem to work that out :?

 

Thanks

By overriding the onPaint method and drawing the image?

There's a bunch of threads that show you how to do this, you should try searching the forum instead of making a new thread for every trivial thing:

 

Edited by Explv

6 minutes ago, scriptersteve said:

Fair enough, i had read that 

Well it's on there, near the bottom.

( You can also use an image stored online, instead of storing in the resources directory)

Assuming your images are stored in a directory called "resources"

 

Firstly you need to read the image from the file. This should NOT be done inside the onPaint method as this would be VERY inefficient.

Declare the images you need as global variables of type BufferedImage, for example:

...
public class Main extends Script{

    BufferedImage background;
    
    @Override
    public void onStart(){

    }

    ...
}

Now we need to read the image from its file into the variable. This should be done inside onStart, as we only need to do it once:

...
public class Main extends Script{

    BufferedImage background;
    
    @Override
    public void onStart(){
        
        try{

            background = ImageIO.read(Main.class.getResourceAsStream("/resources/background.png"));
        } catch(IOException e){

            log(e);
        }
    }

    ...
}

Now that the image has been read from its file we can draw it inside the onPaint method using g.drawImage:

public class Main extends Script{

    BufferedImage background;
    
    @Override
    public void onStart(){
        
        try{

            background = ImageIO.read(Main.class.getResourceAsStream("/resources/background.png"));
        } catch(IOException e){

            log(e);
        }
    }

    ...

    @Override
    public void onPaint(Graphics2D g){

        if(background != null){

            g.drawImage(background, null, x, y);
        }

    }
}

Edited by Explv

  • Author

Yeah i know, my problem was i'm not quite sure where the picture needs to be saved i.e your resources/background - i was putting in my location and it isn't working

That was my problem - probs should have specified before 

  • Author
10 minutes ago, scriptersteve said:

Yeah i know, my problem was i'm not quite sure where the picture needs to be saved i.e your resources/background - i was putting in my location and it isn't working

That was my problem - probs should have specified before 

"/src/emma.jpg"

is what i was using

15 minutes ago, scriptersteve said:

"/src/emma.jpg"

is what i was using

/resources/emma.jpg

/src/YourCode.java

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.