Search the Community
Showing results for tags 'paint api'.
-
Bob Ross would be so proud! Example code: import java.awt.Color; import java.awt.Graphics2D; import java.util.List; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import com.liverare.api.PaintAPI; @ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0) public class Test extends Script { PaintAPI paint; Area safeSpace; List<NPC> guards; @Override public void onStart() throws InterruptedException { paint = new PaintAPI(); paint.exchangeContext(bot); safeSpace = myPlayer().getArea(5); } @Override public int onLoop() throws InterruptedException { guards = npcs.filter(Test::isGuard); return 100; } private static boolean isGuard(NPC npc) { return npc.getName().equals("Guard"); } @Override public void onPaint(Graphics2D g) { g.setColor(Color.BLACK); g.setBackground(Color.PINK); // dont worry bout checks fam, i do dat paint.drawMinimapArea(g, safeSpace); paint.drawEntities(g, guards, Test::guardToString, true, false, false, false, false, false, true); } private static String guardToString(NPC npc) { return "Health: " + npc.getHealthPercent() + ", xyz: " + npc.getPosition().toString(); } } Functions: public void drawLink(Graphics2D g, Entity entity1, Entity entity2) public void drawMinimapArea(Graphics2D g, org.osbot.rs07.api.map.Area area) public <T extends Position> void drawString(Graphics2D g, Function<T, String> toString, T position) public void drawString(Graphics2D g, String aString, Position position) public void drawString(Graphics2D g, String aString, Entity entity) public void drawEntity(Graphics2D g, Entity entity, String aString, boolean labelTile, boolean click, boolean cube, boolean minimap, boolean tile, boolean box, boolean wireframe) public void drawEntity(Graphics2D g, Entity entity, Function<T, String> getDescription, boolean labelTile, boolean click, boolean cube, boolean minimap, boolean tile, boolean box, boolean wireframe) public <T extends Entity> void drawEntities(Graphics2D g, Collection<T> entities, Function<T, String> getDescription, boolean labelTile, boolean click, boolean cube, boolean minimap, boolean tile, boolean tileCube, boolean wireframe) private void drawBox(Graphics2D g, Entity entity) private void drawBox(Graphics2D g, Position bottomTile, Position topTile) private void drawWireframe(Graphics2D g, Entity entity) private void drawClickBounds(Graphics2D g, Entity entity) private void drawCube(Graphics2D g, Entity entity) public void drawMinimapPoint(Graphics2D g, Vector3D v) public void drawMinimapLink(Graphics2D g, Vector3D a, Vector3D b) public void drawTile(Graphics2D g, Entity entity) public void drawTile(Graphics2D g, Position position) public static void drawPoint(Graphics2D g, Point point, int size) public static void drawPoint(Graphics2D g, int x, int y, int size) public static void drawShape(Graphics2D g, Shape shape) public static void drawString(Graphics2D g, String aString, int x, int y) public static void drawString(Graphics2D g, String aString, Point point) public static void drawString(Graphics2D g, String aString, Rectangle rectangle) Source:
- 25 replies
-
- 11