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.

Interactable Paint - Not working on OSBot 2 .. ?

Featured Replies

  • Author

I've made all my scripts with intractable paints.. The code I am currently using doesn't work?

boolean hide;
Point p;
Rectangle hideBox = new Rectangle(52, 41, 70, 81);

public void mouseEntered(MouseEvent e) {
     p = e.getPoint();
     
         if(hideBox.contains(p) && !hide) {
         hide= true;
         } else if(hideBox.contains(p) && hide){
         hide = false;
         }
 } 

and then in the paint section..

 

if (!hide) {

        g.drawString("Showing Paint...", 0,0)

  } else {

        g.drawString("Not Showing PAint...",0,0)

 
Thanks for the help!smile.png

Edited by BrownBird

 

I've made all my scripts with intractable paints.. The code I am currently using doesn't work?

boolean hide;
Point p;
Rectangle hideBox = new Rectangle(52, 41, 70, 81);

public void mouseEntered(MouseEvent e) {
     p = e.getPoint();
     
         if(hideBox.contains(p) && !hide) {
         hide= true;
         } else if(hideBox.contains(p) && hide){
         hide = false;
         }
 } 

and then in the paint section..

 

if (!hide) {

        g.drawString("Showing Paint...", 0,0)

  } else {

        g.drawString("Not Showing PAint...",0,0)

 
Thanks for the help!smile.png

 

public class BotMouseListener implements MouseListener {
		@Override
		public void mouseClicked(MouseEvent e) {
                       // TODO Auto-generated method stub
		}

		@Override
		public void mouseEntered(MouseEvent e) {
			// PUT YOUR MOUSE CODE HERE!!!!!!!!            

		}

		@Override
		public void mouseExited(MouseEvent e) {
			// TODO Auto-generated method stub

		}

		@Override
		public void mousePressed(MouseEvent e) {
			// TODO Auto-generated method stub

		}

		@Override
		public void mouseReleased(MouseEvent e) {
			// TODO Auto-generated method stub

		}

	}
// IN onStart METHOD!
MouseListener bml = new BotMouseListener();
bot.addMouseListener(bml);
  • Author

Ahh I see, I'll try it out! Thanks! ^.^

 

Edit.. Not working .. :/ just gunna play with it for now 

Edited by BrownBird

The only difference is that in OSB2, the Script class doesnt implement MouseListener by default. You have to manually add your mouselistener

here, example usage of how to hide a paint:

 

 

declare your hide and show images at the top of your script with your variables:

private final Image showImage = getImage("http://s28.postimg.org/hcce8fx9l/show_fw.png");
private final Image hideImage = getImage("http://s29.postimg.org/8g0qpcipv/hide_fw.png");

you need a tiny method to grab images from the internet, so put this below the above:

private Image getImage(String url)
		  {
		    try
		    {
		      return ImageIO.read(new URL(url));
		    }
		    catch (IOException e) {}
		    return null;
		  }

next you need to declare your point to click on so put this below the above with your other variables ^ :

Point p;

next you need your boolean for whether your paint is hidden or not and declare it, put this below the above:

	  	boolean hide = false;

next you need two rectangles, one for where you click to hide the paint and the next for where you click to show it, declare these with your variables to:

(check the api to find out which numbers are which)

	  	Rectangle close = new Rectangle(10, 457, 118, 20);
		Rectangle open = new Rectangle(10, 457, 118, 20);

now in your onStart() method you need to put this:

	    bot.addMouseListener(new MouseListener() {//register a new MouseListener
            @Override
            public void mouseClicked(MouseEvent e) {
        	    p = e.getPoint();
        	    if (close.contains(p) && !hide) {
        	        hide = true;
        	    } else if (open.contains(p) && hide) {
        	        hide = false;
        	    }
            }

            @Override
            public void mousePressed(MouseEvent e) {

            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });

next you need to sort out your onPaint method, so that you have two if statements like this:

	public void onPaint(Graphics2D g)
	  {
	    Graphics2D gr = g;
		  if (!hide)
		  {
                    // put your paint in here e.g:
                    g.drawString(ft(timeRan), 295, 349);
                  }
                  
                  if (hide) 										  {
                    // here you put the image to show when your paint is hidden e.g:
		    g.drawImage(this.showImage, 10, 457, null);
		  }
          }

if you have any more questions, pm me.

a like for this post wouldnt go a miss it took a little while lol.

Guest
This topic is now closed to further replies.

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.