-
Posts
2314 -
Joined
-
Last visited
-
Days Won
6 -
Feedback
100%
Everything posted by Explv
-
Or you can just do private final Area LUMBRIDGE_BANK = new Area(new Position(3205, 3208, 2), new Position(3216, 3229, 2));
-
This code wont make any difference. Considering his walking code will be inside the onLoop method, the same functionality will occur. The issue lies somewhere else, probably with the walker stopping outside the area due to its minThreshold setting.
-
Missed a line out: -keepattributes *Annotation* Which is essential, because you need to keep the @ScriptManifest annotation. I have edited the config.
-
Maybe not for you, but some people asked me to make it, and some people don't know how to do it
-
As some people do not know how to do this, and it is useful to prevent people stealing your code, here is how to obfuscate (https://en.wikipedia.org/wiki/Obfuscation) using ProGuard. If you don't know what Obfuscation looks like, here is an example of one of my classes, post obfuscation: 1. Download and extract proguard http://sourceforge.net/projects/proguard/files/ 2. Create a folder anywhere called "proguard_configs", this is where you will store your configuration files to be used with ProGuard. 3. In the proguard_configs folder, create a new empty proguard config file (.pro) in notepad. 4. Define your configuration, here is the configuration I use for my scripts: -injars C:\Users\Username\OSBot\Scripts\script.jar -outjars C:\Users\Username\Obfuscated\script_obf.jar -libraryjars C:\Users\USername\Downloads\OSBot 2.4.29.jar -libraryjars C:\Program Files\Java\jre1.8.0_66\lib\rt.jar -keepattributes *Annotation* -keep public class package.Main -injars is file path to the script .jar to be obfuscated -outjars is the file path to the obfuscated script .jar -libraryjars are the OSBot.jar and the Java runtime rt.jar -keepattributes *Annotation* ensures that we keep the @ScriptManifest annotation Finally we specifiy that we want to keep the main Script class, as we need this as the entry point to our script. You should replace "package.Main" with the package that your script is in, and the name of your main script file 5. Finally run the following command in cmd / terminal, replacing path_to_proguard with the path to proguard.jar, which is found in the proguard\lib folder, and path_to_config with the path to the .pro file you previously made: java -jar path_to_proguard.jar @path_to_config.pro 6. Note if you get warnings about missing classes, that are not classes you have defined, add to you config the line, replacing javafx with the package name: -dontwarn javafx.**
- 28 replies
-
- 12
-
-
You should place the image inside of a folder called "resources". This folder should be placed within src You then load the image using: private void initComponents() { Image image = getImage("title.png"); if(image != null) label1.setIcon(new ImageIcon(image)); } private Image getImage(String imageName){ try{ return ImageIO.read(TutorialIsland.class.getResourceAsStream("/resources/" + imageName)); } catch(IOException e){ } return null; }
-
I have rewritten it slightly. I put the onLoop code inside if(!myPlayer().isAnimating()) so that it will not click the Tea stall if it is already thieving. Then I added a ConditionalSleep after the interaction, which stops sleeping when the player has begun animating. (untested) import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "You", info = "My first script", name = "Tea thiever", version = 1.0, logo = "") public class TeaStealer extends Script { private enum State { STEAL, DROP } @Override public int onLoop() throws InterruptedException { if(!myPlayer().isAnimating()) { switch (getState()) { case STEAL: steal(); break; case DROP: drop(); break; } } return random(200, 300); } private State getState() { if(getInventory().isFull()) return State.DROP; return State.STEAL; } private void steal(){ Entity stall = getObjects().closest("Tea stall"); if (stall != null) { stall.interact("Steal-from"); new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } private void drop(){ getInventory().dropAll(); } }
-
Works fine for me when I run it (not on OSBot): The only thing I had to remove was: label1.setIcon(new ImageIcon(getClass().getResource("/title.png")); because I don't have the image obviously. Perhaps you are getting an NPE because one of the image locations is wrong
-
import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.utility.ConditionalSleep; public class DoorHelper { private final Script S; public DoorHelper(final Script S){ this.S = S; } public RS2Object getDoor(Area doorArea){ //noinspection unchecked return S.getObjects().closest(obj -> obj.getName().equals("Door") && doorArea.contains(obj)); } public boolean doorIsClosed(RS2Object door){ return door.hasAction("Open"); } public void openDoor(Area doorArea){ RS2Object door = getDoor(doorArea); if(door != null && doorIsClosed(door)){ door.interact("Open"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return !doorIsClosed(getDoor(doorArea)); } }.sleep(); } } }
-
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?
-
That is incorrect, and also he said walker.walk doesn't work
-
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);
-
walking.walk(area.getRandomPosition()); or walking.webWalk(area.getRandomPosition()); ?
-
You are right, I wasn't thinking about the drawImage methods in Graphics.
-
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.
-
deleted answer Ignore the stupid shit I said
-
-Deleted duplicate-
-
Thanks It will be free, just waiting for the script to be uploaded :P
-
Paste your exact code?
-
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);
-
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); }
-
Do you mean a predefined path? Or colour all the tiles that your player walks to?