Leaderboard
Popular Content
Showing content with the highest reputation on 05/15/24 in all areas
-
Painter classes that allows a user to select any entities through the paint. 1. Copy this class into your project, Adjust the package if needed. package Paint; import org.osbot.rs07.api.EntityAPI; import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.canvas.paint.Painter; import org.osbot.rs07.input.mouse.BotMouseListener; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.script.Script; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.geom.Area; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; public abstract class EntitySelectionPainter<T extends Entity> extends BotMouseListener implements Painter { private final EntityAPI<T> entityAPI; private final Color FINISH_SELECTION_BG = new Color(25, 240, 25, 156); private final Color ALPHA_GREEN = new Color(25, 240, 25, 20); private final Color ALPHA_RED = new Color(250, 25, 25, 20); private final Filter<T> validEntityFilter; private final Script script; private List<T> visibleEntities; private final HashSet<T> selectedEntities; private final boolean isSingleSelection; private int frameCounter = 0; private Rectangle finishSelectionRect; private boolean isSelectionComplete = false; private final static String CONFIRM_SELECTION = "Confirm Selections"; protected EntitySelectionPainter(Script script, Filter<T> validEntityFilter, EntityAPI<T> entityAPI, boolean isSingleSelection) { this.entityAPI = entityAPI; this.script = script; this.validEntityFilter = validEntityFilter; this.selectedEntities = new HashSet<>(); this.isSingleSelection = isSingleSelection; script.getBot().addPainter(this); script.getBot().addMouseListener(this); } @Override public void onPaint(Graphics2D g2d) { setFinishSelectionRectangle(g2d); frameCounter += 1; if (frameCounter % 100 == 0) { queryValidEntities(); script.log("Found " + visibleEntities.size()); } for (T entity : visibleEntities) { if(entity == null) continue; Area entityOutline = getEntityOutline(entity); if(entityOutline != null) { g2d.setColor(selectedEntities.contains(entity) ? Color.GREEN : Color.RED); g2d.draw(entityOutline); g2d.setColor(selectedEntities.contains(entity) ? ALPHA_GREEN : ALPHA_RED); g2d.fill(entityOutline); continue; } Shape positionOutline = getEntityPositionShape(entity); if(positionOutline != null) { g2d.setColor(selectedEntities.contains(entity) ? Color.GREEN : Color.RED); g2d.draw(positionOutline); } } drawFinishSelectionRectangle(g2d); } @Override public void checkMouseEvent(MouseEvent mouseEvent) { if (mouseEvent.getID() != MouseEvent.MOUSE_PRESSED || mouseEvent.getButton() != MouseEvent.BUTTON1) { return; } Point clickPt = mouseEvent.getPoint(); if (finishSelectionRect != null && finishSelectionRect.contains(clickPt)) { isSelectionComplete = true; mouseEvent.consume(); return; } for (T entity : visibleEntities) { Rectangle entityBoundingBox = getEntityBoundingBox(entity); // Draw the outline of the tile (position) for an NPC. If too many players interact with a NPC at any point // It will disappear. ex: splashing host @ Ardy knights. boolean cannotGetBB = entityBoundingBox == null; if (cannotGetBB) script.warn(String.format("Entity bounding box is null (%s @ %s). Attempting to use Position Shape.", entity.getName(), entity.getPosition())); if (!cannotGetBB && entityBoundingBox.contains(clickPt)) { mouseEvent.consume(); userClickedEntityHelper(entity); continue; } Shape npcPositionOutline = getEntityPositionShape(entity); if(npcPositionOutline == null) { script.warn(String.format("Unable to get the Entity Position Shape for %s @ %s", entity.getName(), entity.getPosition())); continue; } if(npcPositionOutline.contains(clickPt)) { mouseEvent.consume(); userClickedEntityHelper(entity); } } } public ArrayList<T> awaitSelectedEntities() throws InterruptedException { while (!isSelectionComplete) { MethodProvider.sleep(1000); } if (selectedEntities.isEmpty()) { script.warn("Nothing was selected!"); } cleanup(); return new ArrayList<>(selectedEntities); } private void userClickedEntityHelper(T entity) { if(isSingleSelection) { boolean isDeselect = selectedEntities.contains(entity); selectedEntities.clear(); if(!isDeselect) selectedEntities.add(entity); return; } if (selectedEntities.contains(entity)) { script.log(String.format("Removing entity (id: %d)", entity.getId())); selectedEntities.remove(entity); } else { script.log(String.format("Added entity (id: %d)", entity.getId())); selectedEntities.add(entity); } } private void setFinishSelectionRectangle(Graphics2D g2d) { if(finishSelectionRect != null) { return; } FontMetrics metrics = g2d.getFontMetrics(); int width = metrics.stringWidth(CONFIRM_SELECTION) + 30; int numLines = CONFIRM_SELECTION.split("\n").length; int height = metrics.getHeight() * numLines + 30; finishSelectionRect = new Rectangle(0, 0, width, height); } private void drawFinishSelectionRectangle(Graphics2D g2d) { g2d.setColor(FINISH_SELECTION_BG); g2d.fill(finishSelectionRect); FontMetrics metrics = g2d.getFontMetrics(); int textX = finishSelectionRect.x + 15; int textY = finishSelectionRect.y + 15 + metrics.getAscent(); g2d.setColor(Color.WHITE); g2d.drawString(CONFIRM_SELECTION, textX, textY); } private void queryValidEntities() { //noinspection unchecked visibleEntities = entityAPI.filter(validEntityFilter).stream().distinct().collect(Collectors.toList()); if (visibleEntities.isEmpty()) { script.log("Found no NPCs with supplied filter"); } } private Rectangle getEntityBoundingBox(T entity) { return entity.getModel().getBoundingBox(entity.getGridX(), entity.getGridY(), entity.getZ()); } private Shape getEntityPositionShape(T entity) { Position position = entity.getPosition(); if (position != null) { return position.getPolygon(script.getBot()); } return null; } private Area getEntityOutline(T entity) { return entity.getModel().getArea(entity.getGridX(), entity.getGridY(), entity.getZ()); } public void cleanup() { script.getBot().removePainter(this); script.getBot().removeMouseListener(this); } } 2. Extend EntitySelectionPainter. ex: For RS2Objects (and its implementations GroundDecoration, InteractableObject, WallDecoration, WallObject) package Paint; import org.osbot.rs07.api.Objects; import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; public class Rs2ObjectSelectionPainter extends EntitySelectionPainter<RS2Object> { public Rs2ObjectSelectionPainter(Script script, Filter<RS2Object> validEntityFilter, Objects objects, boolean isSingleSelection) { super(script, validEntityFilter, objects, isSingleSelection); } } ex: For NPCs package Paint; import org.osbot.rs07.api.NPCS; import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; public class NPCSelectionPainter extends EntitySelectionPainter<NPC> { public NPCSelectionPainter(Script script, Filter<NPC> validEntityFilter, NPCS npcs, boolean isSingleSelection) { super(script, validEntityFilter, npcs, isSingleSelection); } } 3. Use in your project. I put this in onStart(). You will need a filter to only highlight applicable Entities for your script. This below example is from a construction script, therefore only objects that have the "Build" action will be highlighted. The isSingleSelection boolean controls if the user can only select 1 entity at a time. ex: A construction script may only want to select 1 larder build space. Rs2ObjectSelectionPainter buildSpotSelectionPainter; @Override public void onStart() throws InterruptedException { super.onStart(); buildSpotSelectionPainter = new Rs2ObjectSelectionPainter(this, object -> object.hasAction("Build"), objects, false); ArrayList<RS2Object> selectedObjects = buildSpotSelectionPainter.awaitSelectedEntities(); log("# objects: " + selectedObjects.size()); for (RS2Object e: selectedObjects) { log(e.getName() + " " + e.getPosition()); } }1 point
-
MW - F2P Hill Giant Magic Safe Spotter The name basically already says it all... This script will safespot hill giants with magic(fire strike) in the edgeville dungeons! Supported features: Progressional spell usage: Fire Strike => Fire Bolt => Fire Blast Buries bones until level 40 for ranged prayer. NEEDED for killing Obor after 59 magic Trains defends magic until level 20 defence. Switched to pure magic after Randomizes safespotting location every run for a humanlike playstyle Hops worlds when there are too many people in the area Detects when you need to walk to your safespot or not Level up dialogue skipper Looting personal kill Buying supplies Selling loot Neat paint Banking CLI support Not YET supported features but maybe will be in the future: Fuzzy logic for randomized decision making AI for optimized decision making Dynamic safespotting algorithm Different foods Obor support Pre-requirements: - RECOMMENDED to have Level 13 magic. Starting from level 1 magic works, but it breaks around level 13 and needs to be resetted; - If you do not have a 'staff of fire', 'lobster', 'mind runes', 'air runes' and a 'brass key', you need atleast 3.5k coins! - Ingame screen options MUST be "fixed"; IRON MAN You are not supported. A way around this to still use the script: - have plenty of mind, chaos, death and air runes for fire strike/bolt/blast. - would be to buy lobsters from brimhaven. - have a brass key available. If you are out of runes or lobsters the script will go and try to use the GE. So pay attention to when you are out of these things. You mostlikely will get banned if you get stuck doing some GE stuff as an iron man. *Feel free to always add suggestions! *Please if you find any bugs submit them to me, so I can hotfix them! Also do NOT bot for unhumanlike hours ongoing and then complain that you got banned... No human alive safespots hill giants, banks, buys/sell supplies for 4+ hours straight with no breaks How to use CLI: "-script 1167:botmin.*.botmax.*.breakmin.*.breakmax.*" At the place of the "*" you should place a number. So for example "-script 1167:botmin.10.botmax.20.breakmin.30.breakmax.40". this would mean the bot will play between 10 & 20 minutes and break between 30 & 40 minutes. Changes1 point
-
Hey, This release brings a couple small fixes that slipped through the previous release. MISC: - Minor bug fixes. - The OSBot Team1 point
-
About: Learn more about the mini-game here: https://oldschool.runescape.wiki/w/Sorceress's_Garden VIP only script Features Supported Rewards - Pick Herbs or Pick Sq'irk Fruit Juice Reward Mode - Start the script at the bank with a pestle and mortar to enable this mode automatically when your inventory is full. You must have beer glass in the bank to use this mode. Currently, the script will always withdraw 15 beer glass and 5 energy potions. Bank Reward Mode - If you do not enable juice reward, the script will bank the fruit or herbs picked and return back to the mini-game. If you are picking herbs then the script will always grab 3 energy potions on return. Supported Potions - Normal energy potions, Super energy potions, and Stamina potions. Supported Gardens - Winter, Spring, Autumn Invoke Interaction Mode - Interaction method that does not use the mouse. Useful for position accuracy and successful attempts. This is off by default and only enabled by you. The script will use the mouse to click the mini-map if you do not use invoke interaction. CLI Compatibility: 1) (Required) Garden Parameters: enableWinter, enableSpring, and enableAutumn 2) (Required) Reward Parameters: enableHerbMode, enableFruitMode 3) (Required) Energy Potion Parameters: enableNormalEnergy, enableSuperEnergy, enableStamina 4) (Optional) Interaction Parameter: enableInvoke (off by default) (do not include if you want to use the mouse) Example -script 1220:enableWinter_enableHerbMode_enableSuperEnergy_enableInvoke Media Pick only mode Juice mode1 point
-
1 point
-
1 point
-
1 point
-
1 point
-
I have used it and it doenst do that. Unless you changed it recent? I am talking about 2 months ago. I used it for like 60M fm xp. Let me know, soon gonna buy few scripts from you more. Greetings the Lannisters1 point
-
1 point
-
1 point
-
1 point
-
when using protect melee with a very low level pure, using rumble normal, if the mobs dont spawn for a while so there is a short period out of combat, it will allow pray points to run out and then not sip pot and put pray back up once back in combat1 point
-
1 point
-
1 point
-
0 points