Jump to content

Adding ( Polygon Shape ) help


Recommended Posts

Posted (edited)

Hello guys, I need help adding a Polygon Shape in to my target object, I dont know whats wrong with my code..

Best regards, Mr Pro Pop.

Thanks In Advance!

 

 

here is the code:

import java.awt.Color;
import java.awt.Graphics2D;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Mr Pro Pop", info = "", logo = "", name = "woodcutting", version = 1)
public class wc extends Script {

	public void chop() throws InterruptedException {

		if (!myPlayer().isAnimating() && !getInventory().isFull()) {
			RS2Object tree = getObjects().closest("Tree");
			tree.interact("Chop down");
		}
	}


	public int onLoop() throws InterruptedException {
		chop();
		sleep(random(100+1800,2100));
		return 0;
	}

	public void onPaint(Graphics2D g) {
		Color color1 = new Color(255, 255, 255, 255);
		g.setColor(color1);
		RS2Object tree = getObjects().closest("Tree");
		int x = tree.getPosition().getX();
		int y = tree.getPosition().getY();
		int h = tree.getHeight();
		g.drawRect(x, y, 75, h);

	}
}

Edited by Mr Pro Pop
Posted

 

Hello guys, I need help adding a Polygon Shape in to my target object, I dont know whats wrong with my code..

Best regards, Mr Pro Pop.

Thanks In Advance!

 

 

here is the code:

import java.awt.Color;
import java.awt.Graphics2D;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Mr Pro Pop", info = "", logo = "", name = "woodcutting", version = 1)
public class wc extends Script {

	public void chop() throws InterruptedException {

		if (!myPlayer().isAnimating() && !getInventory().isFull()) {
			RS2Object tree = getObjects().closest("Tree");
			tree.interact("Chop down");
		}
	}


	public int onLoop() throws InterruptedException {
		chop();
		sleep(random(100+1800,2100));
		return 0;
	}

	public void onPaint(Graphics2D g) {
		Color color1 = new Color(255, 255, 255, 255);
		g.setColor(color1);
		RS2Object tree = getObjects().closest("Tree");
		int x = tree.getPosition().getX();
		int y = tree.getPosition().getY();
		int h = tree.getHeight();
		g.drawRect(x, y, 75, h);

	}
}

you should use conditional sleeps instead of random sleeps also couldn't you just use a uhh bounding box is that for npc's only idk

Posted

you should use conditional sleeps instead of random sleeps also couldn't you just use a uhh bounding box is that for npc's only idk

Okay bro ill use conditional sleeps.

anyways i dont know how to add the bounding box, can you provide me with the code please.. ?

Polygon is a 2D shape. Your tree is in 3D space.

so what do i need to do, any method to get it working ?

Posted

Okay bro ill use conditional sleeps.

anyways i dont know how to add the bounding box, can you provide me with the code please.. ?

so what do i need to do, any method to get it working ?

Graphics2D paints on your canvas, not in runescape space, so you can't paint based on runescape coordinates. You need to project the 3D runescape space coordinates onto the camera plane to get the actual position on the canvas of a game object. Take a look at the GraphicUtilities class, everything you need should be there.

  • Like 1
Posted (edited)

Graphics2D paints on your canvas, not in runescape space, so you can't paint based on runescape coordinates. You need to project the 3D runescape space coordinates onto the camera plane to get the actual position on the canvas of a game object. Take a look at the GraphicUtilities class, everything you need should be there.

I tryed but couldnt get it to work with me, can you please provide me with the code, Will really appreciate. Thanks wink.png

Edited by Mr Pro Pop

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...