September 14, 20169 yr 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 September 14, 20169 yr by Mr Pro Pop
September 14, 20169 yr 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
September 14, 20169 yr Author 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 ?
September 14, 20169 yr 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.
September 15, 20169 yr Author 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 Edited September 15, 20169 yr by Mr Pro Pop
Create an account or sign in to comment