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.

bounding box paint

Featured Replies

For some reason the paint for bounding box is off. I used the same code for detecting clicks inside the bounding box and that works in the correct positions, but the paint is offset from the actual. Would anyone know why?

boundingbox.PNG

Edit: They seem to be lining up diagonally

boundingbox2.PNG.3d85eb5a643c0ab42654e295b3ef261c.PNG

Edited by Cloxygen

I mean, it would be great if you would show us your code.

  • Author
1 minute ago, Vilius said:

I mean, it would be great if you would show us your code.

 
This Works:

private MouseListener clickListener = new MouseListener() {
    @Override
    public void mouseClicked(MouseEvent e) {
        if (startButton.contains(e.getPoint())) {
            started = true;
        } else if (!started) {
            for (int i = 0; i < selectedTrees.size(); i++) {
                if (selectedTrees.get(i).getModel().getBoundingBox(selectedTrees.get(i).getGridX(), selectedTrees.get(i).getGridY(), selectedTrees.get(i).getZ()).contains(e.getPoint())) {
                    selectedTrees.remove(selectedTrees.get(i));
                    return;
                }
            }
            for (int i = 0; i < nearbyTrees.size(); i++) {
                if (nearbyTrees.get(i).getModel().getBoundingBox(nearbyTrees.get(i).getGridX(), nearbyTrees.get(i).getGridY(), nearbyTrees.get(i).getZ()).contains(e.getPoint())) {
                    selectedTrees.add(nearbyTrees.get(i));
                    return;
                }
            }
        }
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }
};

This Doesn't:


public void onPaint(final Graphics2D g) {

if (choppingArea.contains(myPlayer())) {
    //Paints nearby trees
    if (!started) {
        g.setColor(Color.WHITE);
        g.drawString("PLEASE SELECT ORE.", 195, 305);
        g.setColor(Color.GRAY);
        for (int i = 0; i < nearbyTrees.size(); i++) {
                checkTree = nearbyTrees.get(i);
                model = checkTree.getModel();
                g.draw(model.getBoundingBox(checkTree.getGridX(),checkTree.getGridX(),checkTree.getZ()));
        }
        g.drawImage(startButtonimg, 645, 452, null);
    }

    g.setColor(Color.WHITE);
    for(int i = 0;i < selectedTrees.size();i++){
        if(selectedTrees.get(i) != null){
            checkTree = selectedTrees.get(i);
            model = checkTree.getModel();
            g.draw(model.getBoundingBox(checkTree.getGridX(),checkTree.getGridX(),checkTree.getZ()));
        }
    }

}

35 minutes ago, Cloxygen said:


 

This Works:

private MouseListener clickListener = new MouseListener() {
    @Override
    public void mouseClicked(MouseEvent e) {
        if (startButton.contains(e.getPoint())) {
            started = true;
        } else if (!started) {
            for (int i = 0; i < selectedTrees.size(); i++) {
                if (selectedTrees.get(i).getModel().getBoundingBox(selectedTrees.get(i).getGridX(), selectedTrees.get(i).getGridY(), selectedTrees.get(i).getZ()).contains(e.getPoint())) {
                    selectedTrees.remove(selectedTrees.get(i));
                    return;
                }
            }
            for (int i = 0; i < nearbyTrees.size(); i++) {
                if (nearbyTrees.get(i).getModel().getBoundingBox(nearbyTrees.get(i).getGridX(), nearbyTrees.get(i).getGridY(), nearbyTrees.get(i).getZ()).contains(e.getPoint())) {
                    selectedTrees.add(nearbyTrees.get(i));
                    return;
                }
            }
        }
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }
};

This Doesn't:


public void onPaint(final Graphics2D g) {

if (choppingArea.contains(myPlayer())) {
    //Paints nearby trees
    if (!started) {
        g.setColor(Color.WHITE);
        g.drawString("PLEASE SELECT ORE.", 195, 305);
        g.setColor(Color.GRAY);
        for (int i = 0; i < nearbyTrees.size(); i++) {
                checkTree = nearbyTrees.get(i);
                model = checkTree.getModel();
                g.draw(model.getBoundingBox(checkTree.getGridX(),checkTree.getGridX(),checkTree.getZ()));
        }
        g.drawImage(startButtonimg, 645, 452, null);
    }

    g.setColor(Color.WHITE);
    for(int i = 0;i < selectedTrees.size();i++){
        if(selectedTrees.get(i) != null){
            checkTree = selectedTrees.get(i);
            model = checkTree.getModel();
            g.draw(model.getBoundingBox(checkTree.getGridX(),checkTree.getGridX(),checkTree.getZ()));
        }
    }

}

"

g.draw(model.getBoundingBox(checkTree.getGridX(),checkTree.getGridX(),checkTree.getZ()));

"

You're using #getGridX() twice here in the painting.

  • Author
22 minutes ago, Bobrocket said:

"


g.draw(model.getBoundingBox(checkTree.getGridX(),checkTree.getGridX(),checkTree.getZ()));

"

You're using #getGridX() twice here in the painting.

 wow i feel dumb, thanks

12 hours ago, Cloxygen said:

 wow i feel dumb, thanks


You can see the pattern of that in how the rectangles are drawn all in a "line" kinda. for future reference

boundingbox2.PNG.3d85eb5a643c0ab42654e295b3ef261c.PNG

Also you don't really wanna use a rectangle because of these red areas

JSBZlxS.png

Edited by dmmslaver

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.