Everything posted by Explv
-
Walk to a random tile inside an area?
it only walks to a random position in the area, if it's already in the area That is because the walker uses default WalkingEvent which walks with a minthreshold of 2 tiles. You should either wait for WalkingEvent to be fixed (if its broken) or just walk to a position deep in the area rather than a random one?
-
Walk to a random tile inside an area?
That is incorrect, and also he said walker.walk doesn't work
-
Walk to a random tile inside an area?
You should use WakingEvent, however I feel like the min threshold stuff might not be working right now. You could try: MainScreenTileDestination destination = new MainScreenTileDestination(getBot(), area.getRandomPosition()); getMouse().click(destination); or: MiniMapTileDestination destination = new MiniMapTileDestination(getBot(), area.getRandomPosition()); getMouse().click(destination);
-
Walk to a random tile inside an area?
walking.walk(area.getRandomPosition()); or walking.webWalk(area.getRandomPosition()); ?
-
Anyone got the code for GetImage?
You are right, I wasn't thinking about the drawImage methods in Graphics.
-
Client bug?
Your logic is flawed that's why. You have nested if(random == 2) inside if(random == 1). So the code inside if(random == 2) will never be executed, because it can only be reached if random = 1... It should look more like: public void antiBan2() throws InterruptedException { int random = random(1,3); switch(random){ case 1: sleep(random(1000, 2000)); mouse.moveRandomly(random(1000, 2000)); break; case 2: sleep(random(1000, 2000)); mouse.moveRandomly(random(300, 1000)); mouse.moveRandomly(random(1000, 2000)); break; } } That is because the walker in OSBot walks to a position within (i think) 2 tile accuracy. If you want it to walk to the exact tile, you will need to create your own WalkingEvents.
-
Anyone got the code for GetImage?
deleted answer Ignore the stupid shit I said
- Anyone got the code for GetImage?
-
Anyone got the code for GetImage?
-Deleted duplicate-
-
if you like kinks / other shit
- Explv's Walker
Thanks It will be free, just waiting for the script to be uploaded :P- Walking to a specific tile
Paste your exact code?- Walking to a specific tile
My bad i thought you could chain them. In that case just separate it like this: WalkingEvent walkingEvent = new WalkingEvent(position); walkingEvent.setMinDistanceThreshold(0); execute(walkingEvent);- How to draw my path?
Colouring every tile that your player walks to: private final List<Position> WALKED_POSITIONS = new ArrayList<>(); @Override public void onPaint(Graphics2D g){ updateWalkedPositions(); drawWalkedPositions(g); } private void updateWalkedPositions(){ if(!WALKED_POSITIONS.contains(myPosition())) WALKED_POSITIONS.add(myPosition()); } private void drawWalkedPositions(Graphics2D g){ for(Position position : WALKED_POSITIONS) fillPositionOnScreen(position, g); } private void fillPositionOnScreen(Position position, Graphics2D g){ Polygon polygon = position.getPolygon(script.getBot()); g.fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints); }- How to draw my path?
Do you mean a predefined path? Or colour all the tiles that your player walks to?- Walking to a specific tile
WalkingEvent walkingEvent = new WalkingEvent(position); walkingEvent.setMinDistanceThreshold(0); execute(walkingEvent);- What JFrame component is this?
Titled Border https://docs.oracle.com/javase/7/docs/api/javax/swing/border/TitledBorder.html- DoorHandler NullPointerException?
No problem- How to draw my path?
You can use "Explv's Location Assistant" in the Other section, and just copy-paste your path, it will show on screen.- doorHandler not behaving as expected
Maybe the door is not called "Door". Or the area you passed does not contain the door.- Explv's Walker
Yes there are 6 different zoom levels, with each increasing zoom level the map is loaded from an increasing number of images. At zoom level 8, the map is ~50,000 images, and the images are loaded dynamically, so it only loads the images that you can see in the current position.- Explv's Walker
A simple walking script, select your destination and hit start! Price: $1 Purchase Link: https://osbot.org/forum/store/product/675-explvs-walker/ CLI: No preset location: java -jar "/path/to/osbot.jar" -login OSBotUser:OSBotPassword -bot RSUser:RSPassword:RSPin -script 819:none With coordinates (they can be obtained using my map https://explv.github.io/) java -jar "/path/to/osbot.jar" -login OSBotUser:OSBotPassword -bot RSUser:RSPassword:RSPin -script 819:x.y.z Using location name: java -jar "/path/to/osbot.jar" -login OSBotUser:OSBotPassword -bot RSUser:RSPassword:RSPin -script 819:LOCATION_NAME List of currently supported CLI location names:- DoorHandler NullPointerException?
I think you should try and clean up your code a bit. Generally if your code is cleaner, it is easier to spot bugs / optimisations. Here is how you could clean up this class for example. You have two different halls each with the same properties, but different values. So you should probably create an enum to store this information: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; public enum Hall { // TODO: Define these EAST (null, null, null), WEST (null, null, null); final Area HALL_AREA, FIGHT_AREA; final Position[] FIGHT_POS; Hall(final Area HALL_AREA, final Area FIGHT_AREA, final Position[] FIGHT_POS){ this.HALL_AREA = HALL_AREA; this.FIGHT_AREA = FIGHT_AREA; this.FIGHT_POS = FIGHT_POS; } public static Hall getHall(Position playerPosition){ return Hall.EAST.HALL_AREA.contains(playerPosition) ? Hall.EAST : Hall.WEST.HALL_AREA.contains(playerPosition) ? Hall.WEST : null; } public static boolean inFightArea(Position playerPosition){ return EAST.FIGHT_AREA.contains(playerPosition) || WEST.FIGHT_AREA.contains(playerPosition); } public static Area getFightArea(Position playerPosition){ Hall hall = getHall(playerPosition); return hall != null ? hall.FIGHT_AREA : null; } } Seeing as you are sleeping at the end of the execute method, why not just change the return type of execute to an int, and perform the sleep in onLoop. Also I am guessing you have that state() method in every class, so you might as well just put this method into the base Node class: import org.osbot.rs07.script.Script; public abstract class Node { protected final Script S; private final String STATUS; public Node(final Script S, final String STATUS){ this.S = S; this.STATUS = STATUS; } public String status(){ return STATUS; } public abstract boolean validate() throws InterruptedException; public abstract int execute() throws InterruptedException; } Once I cleaned stuff up the code looks like: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.script.Script; import org.osbot.rs07.input.mouse.MiniMapTileDestination; import org.osbot.rs07.utility.ConditionalSleep; public class PickRoom extends Node { public PickRoom(final Script S) { super(S, "Choosing Fight Room"); } public boolean validate() throws InterruptedException { return !Hall.inFightArea(S.myPosition()) && hasFood(); } private boolean hasFood() { return S.getInventory().contains(Constants.FOOD); } public int execute() throws InterruptedException { final Area FIGHT_AREA = Hall.getFightArea(S.myPosition()); if (!canReachFightArea(FIGHT_AREA)) openFightAreaDoor(FIGHT_AREA); else walkInsideFightArea(); return (250 + Script.random(750)); } private boolean canReachFightArea(final Area FIGHT_AREA){ return S.getMap().canReach(FIGHT_AREA.getRandomPosition()); } private void openFightAreaDoor(final Area FIGHT_AREA){ if(S.getDoorHandler().handleNextObstacle(FIGHT_AREA)){ new ConditionalSleep(5_000) { @Override public boolean condition() throws InterruptedException { return S.getMap().canReach(FIGHT_AREA.getRandomPosition()); } }.sleep(); } } /** * * S.getLocalWalker().walk(getFightPos()); * S.walk.walkPath(getFightPos()); * For some reason these wouldn't walk into the room because * the tile I was trying to walk to was too close to my character */ private void walkInsideFightArea(){ Hall hall = Hall.getHall(S.myPosition()); if(hall != null) { S.getMouse().click(new MiniMapTileDestination(S.getBot(), hall.FIGHT_POS[0]), false); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return Hall.inFightArea(S.myPosition()); } }.sleep(); } } }- How to paint NPC?
For that you would do something like: g.fill(npc.getModel().getBoundingBox(npc.getGridX(), npc.getGridY(), npc.getZ())); Note: use g.fill to create a filled in rectangle, or g.draw if you just want the outline.- How to paint NPC?
@Override public void onPaint(Graphics2D g){ g.setColor(Color.RED); g.fill(new MiniMapTileDestination(getBot(), npc.getPosition()).getBoundingBox().getBounds2D()); } - Explv's Walker