Jump to content

Adding ( Polygon Shape ) help


Mr Pro Pop

Recommended Posts

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
Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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