Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

jelleplomp

Members
  • Joined

  • Last visited

  1. please some help
  2. getting this error =\ [ERROR][Bot #1][03/26 04:18:15 PM]: Error in script executor! java.lang.NullPointerException at Searching.walkToArea(Methods.java:98) at JP_COW_KILLER.onLoop(JP_COW_KILLER.java:37) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(vk:97) at java.lang.Thread.run(Unknown Source) line : getLocalWalker().walk(cowFieldEast.getRandomPosition(0));
  3. so your telling me i can use a method that generates a path to an area? XD ffs lol thanks what int do i need to use?
  4. hello, I'am currently trying to create a more enhanced cow killer, I've divided the cow field into 3 different area's: East, South, West so say if im in "East", and there is no attackable cow the bot runs to "South" I've created this method: public void walkToArea(String area, Player p) throws InterruptedException { /* 2 other areas to EAST*/ methods.safeWalkTo(PathSouthToEast); if(area == "East" && whatAreaPlayer(p) == "South") { methods.safeWalkTo(PathSouthToEast); } if(area == "East" && whatAreaPlayer(p) == "West") { methods.safeWalkTo(PathWestToEast); } /*end EAST*/ /* 2 other areas to West*/ if(area == "West" && whatAreaPlayer(p) == "South") { methods.safeWalkTo(PathSouthToWest); } if(area == "West" && whatAreaPlayer(p) == "East") { methods.safeWalkTo(PathEastToWest); } /* 2 other areas to West*/ if(area == "South" && whatAreaPlayer(p) == "West") { methods.safeWalkTo(PathWestToSouth); } if(area == "South" && whatAreaPlayer(p) == "East") { methods.safeWalkTo(PathWestToSouth); } } whatAreaPlayer: public String whatAreaPlayer(Player p) { if (cowFieldSouth.contains(p)) return "South"; if (cowFieldEast.contains(p)) return "East"; if (cowFieldWest.contains(p)) return "West"; return "cant find"; } safeWalkTo (thanks to Renegeade) public void safeWalkTo(Position[] p) throws InterruptedException { this.getLocalWalker().walkPath(p); Position lastPos = p[p.length - 1]; while (true) { double lastDistance = distanceSquared(this.myPosition(), lastPos); if (lastDistance < 4.5d) { break; } Methods.sleep(3000); if (Math.abs(distanceSquared(this.myPosition(), lastPos) - lastDistance) < 1.1d) { ArrayList<Position> shortenedPath = new ArrayList<Position>(); boolean startAdding = false; for (Position pos : p) { if (distanceSquared(this.myPosition(), pos) < 100d) { startAdding = true; } if (startAdding) { shortenedPath.add(pos); } } this.getLocalWalker().walkPath(shortenedPath); } } } private double distanceSquared(Position p1, Position p2) { return Math.pow(p1.getX() - p2.getX(), 2d) + Math.pow(p1.getY() - p2.getY(), 2d); } but now it just wont move... thanks in advance, Jelleplomp
  5. thanks everyone (:
  6. Hi everybody, I need some help, I'm trying to make a monkfighter that will auto heal itself on the monk itself, now i already have this bit of code: private void heal() throws InterruptedException { NPC Monk = (NPC)this.npcs.closest(new String[] { "Monk" }); if(Monk != null && !myPlayer().isUnderAttack() && !Monk.isUnderAttack()) { Monk.interact(new String[] { "Talk-to" }); this.status = "healing at Monk"; getInterfaces().get(231).getChild(2).interact(new String[] { "continue" }); getInterfaces().get(219).getChild(1).interact(new String[] { "can" }); sleep(random(200,300)); getInterfaces().get(217).getChild(2).interact(new String[] { "continue" }); sleep(random(200,300)); getInterfaces().get(231).getChild(2).interact(new String[] { "continue" }); sleep(random(1000, 1500)); } } but in the loop when its opening the interfaces and starting to interact at "can", the onloop method refers back to this method so it will all start over again, meaning it will never go further than this line: getInterfaces().get(231).getChild(2).interact(new String[] { "continue" }); so how do i do this? thanks in advance, Jelleplomp
  7. nevermind i got it fixed tyvm for the help !!
  8. ahh managed to fix it ! I misspelled jug.... but now... the local walker is broke or something it just wont walk...
  9. I've changed the try/catch to throws InterruptedException, also changed the equipment to inventory but still when it's looking for which state it should use in the method: getState() it always returns the one outside the actual ones i need. thats why it gives me the null error. new code: package jugfiller; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.util.ArrayList; import java.util.List; import java.util.Random; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.Message.MessageType; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.Area; @ScriptManifest(author = "JellePlomp", info = "Fills jugs with water", logo = "", name = "jugFiller", version = 1) public class JugFiller extends Script { Position[] PATH_TO_BANK = { new Position(3281,3180,0), new Position(3270,3167,0) }; Position[] PATH_TO_FOUNTAIN = { new Position(3281,3180,0), new Position(3292,3175,0) }; int fountainTimes = 0; public Area AlKharidBank = new Area(3269, 3170, 3272, 3162); public Area AlKharidFountain = new Area(3290,3170,3295,3175); public String state = ""; long startTime; public enum State { BANK_JUGS, //als hij geen jugs meer heeft maar WEL water, en in bank is FILL_JUGS, //als hij empty jugs heeft en in de area fountain is CRASH; } public void onStop() {} public void onStart() { state = "Starting up...wait a moment"; startTime = System.currentTimeMillis(); } public State getState() { if(this.inventory.contains(new String[] {"Jugs"})) { return State.FILL_JUGS; } if(!this.inventory.contains(new String[] {"Jugs"}) && this.inventory.contains(new String[] {"jug of water"})) { return State.BANK_JUGS; } return State.CRASH; } public int onLoop() throws InterruptedException { switch(getState()) { case BANK_JUGS: bank(); break; case FILL_JUGS: fill(); break; case CRASH: log("crashs here"); break; default: break; } return random(200, 300); } public void bank() throws InterruptedException { if (AlKharidBank.contains(myPlayer())) { this.state = "BANKING_JUGS"; if (!this.bank.isOpen()) { this.bank.open(); withdrawJugs(); } else withdrawJugs(); } else if (AlKharidFountain.contains(myPlayer())) { this.state = "WALKING_TO_BANK"; this.safeWalkTo(this.PATH_TO_BANK); EXECUTE_ANTIBAN(); } } public void fill() throws InterruptedException { if (AlKharidFountain.contains(myPlayer())) { this.state = "FILLING_JUGS"; RS2Object fountain = (RS2Object)this.objects.closest(new String[] { "Fountain" }); if (fountain != null) { getInventory().getItem(new String[] { "Jug" }).interact(new String[] { "Use" }); fountain.interact(" -> "); MethodProvider.sleep(random(18000, 20000)); } } else if (AlKharidBank.contains(myPlayer())) { this.state = "WALKING_TO_FOUNTAIN"; this.safeWalkTo(this.PATH_TO_FOUNTAIN); EXECUTE_ANTIBAN(); } } private void safeWalkTo(Position[] p) throws InterruptedException { this.getLocalWalker().walkPath(p); Position lastPos = p[p.length - 1]; while (true) { double lastDistance = distanceSquared(this.myPosition(), lastPos); if (lastDistance < 4.5d) { break; } sleep(3000); if (Math.abs(distanceSquared(this.myPosition(), lastPos) - lastDistance) < 1.1d) { ArrayList<Position> shortenedPath = new ArrayList<Position>(); boolean startAdding = false; for (Position pos : p) { if (distanceSquared(this.myPosition(), pos) < 100d) { startAdding = true; } if (startAdding) { shortenedPath.add(pos); } } this.getLocalWalker().walkPath(shortenedPath); } } } private double distanceSquared(Position p1, Position p2) { return Math.pow(p1.getX() - p2.getX(), 2d) + Math.pow(p1.getY() - p2.getY(), 2d); } public void withdrawJugs() throws InterruptedException { this.bank.depositAll(); this.bank.withdrawAll("Jug"); this.bank.close(); } public void EXECUTE_ANTIBAN() throws InterruptedException { Random r1 = new Random(); float chance = r1.nextFloat(); if (chance <= 0.4F) { antiban(); } } public void antiban() throws InterruptedException { int select = random(3, 6); switch (select) { case 3: int pitch = random(22, 67); getCamera().movePitch(pitch); break; case 4: int yaw = random(1, 360); getCamera().moveYaw(yaw); break; case 5: List<Player> p = getPlayers().getAll(); if (p != null) { int randomNum = Script.random(0, p.size() - 1); Player randomPlayer = (Player) p.get(randomNum); if (randomPlayer != null) { randomPlayer.hover(); getMouse().click(true); sleep(random(200, 500)); } } break; case 6: List<Player> pl = getPlayers().getAll(); if (pl != null) { int randomNum = Script.random(0, pl.size() - 1); Player randomPlayer = (Player) pl.get(randomNum); if (randomPlayer != null) { randomPlayer.hover(); } } break; } } public void onPaint(Graphics2D g) { long elapsed = System.currentTimeMillis() - startTime; g.setColor(Color.YELLOW); g.setFont(new Font("Arial", Font.PLAIN, 10)); g.drawString("Visited fountain: "+fountainTimes+" times", 320, 290); g.drawString("run time: "+format(elapsed)+" times", 320, 315); g.drawString("current state: "+state+"", 320, 330); } public void onMessage(Message c) { if (c.getType() == MessageType.GAME) { String m = c.getMessage().toLowerCase(); try { if(m.contains("fill")) { fountainTimes++; } } catch (Exception exception) { exception.printStackTrace(); } } } public String format(long time) { StringBuilder string = new StringBuilder(); long totalSeconds = time / 1000L; long totalMinutes = totalSeconds / 60L; long totalHours = totalMinutes / 60L; int seconds = (int) totalSeconds % 60; int minutes = (int) totalMinutes % 60; int hours = (int) totalHours % 24; if (hours > 0) { string.append(hours + "h "); } if (minutes > 0) { string.append(minutes + "m "); } string.append(seconds + "s"); return string.toString(); } } btw thank you for helping (:
  10. I'am currently creating a script to fill empty jugs with water, i already got this but when i try to load it in OSbot it crashes. script : **** i fixed the above but now im getting this error : [ERROR][Bot #1][03/20 05:45:15 PM]: Error in script executor! java.lang.NullPointerException at jugfiller.JugFiller.onLoop(JugFiller.java:63) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(il:249) at java.lang.Thread.run(Unknown Source) line 63 : switch(getState()) http://pastebin.com/9kiDJLvK thanks in advance, Jelleplomp
  11. I'am currently creating a script to fill empty jugs with water, i already got this but when i try to load it in OSbot it crashes code : http://pastebin.com/9kiDJLvK thanks in advance, Jelleplomp
  12. just finished my first script simple jug drinker but im still learning

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.