Skip 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.

Explv

Scripter II
  • Joined

  • Last visited

Everything posted by Explv

  1. @@Dbuffed or @
  2. You're welcome. I don't think that the AudioListener class is even listed on the API, so your search would have been futile.
  3. You can add an AudioListener like so: getBot().addAudioListener(i -> {}); Haven't used it before so I'm not too sure what the integer value is, might be the id of the track. What exactly are you trying to achieve?
  4. Good to hear you're enjoying the script. Sorry about the slow updates I have been very busy at work. I'll take a look at this issue this weekend for you. Thanks.
  5. 1) You should have used ExperienceTracker for tracking xp, levels in skills etc. 2) The format time method is ugly For the above two points, Consider reading my Paint tutorial http://osbot.org/forum/topic/87697-explvs-dank-paint-tutorial/ 3) You are using fixed sleeps every where, you should use ConditionalSleep instead where appropriate, so that you can sleep until a condition is true, or for a timeout. 4) There is no point using "States" here, a single if condition would have done the trick, and generally states don't really make anything more readable. 5) Although you have mostly done it, I would recommend splitting your code up into more methods. A method should only be doing one thing. For example, your attacking code should be in a separate method. 6) Adding log statements in onStart() and onExit() like "Welcome to blah". Obviously, this is not an issue, but I don't understand why people do it. When you start a script the logger will already print "Script Started blah", and when you stop it "Script stopped blah". So overriding the onExit() method just to add that seems pointless.
  6. Google Maps JavaScript API? https://developers.google.com/maps/documentation/javascript/examples/polyline-simple
  7. Explv posted a topic in Snippets
    So this is a snippet I wrote as a reply to a thread, but it's pretty buried and some people may find it useful: public final void typeStringInstant(final String output){ for(int i = 0; i < output.length(); i ++){ getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, VK_UNDEFINED, output.charAt(i)); } getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, VK_UNDEFINED, (char) VK_ENTER); }
  8. Explv replied to Han's topic in Scripting Help
    Why would you need to know that? I'm assuming you want to know how long to sleep for, if not, disregard this: The simplest way to sleep until a fire is lit, is to sleep until the player's position has changed. The player always moves after lighting a fire, so you can just do something like: Position currentPos = S.myPosition(); if(S.getInventory().getItem("Logs").interact()) { new ConditionalSleep(15_000) { @ Override public boolean condition() throws InterruptedException { return !S.myPosition().equals(currentPos) && !S.myPlayer().isMoving(); } }.sleep(); }
  9. Instead of checking if your player is under attack (the chicken might not be fighting back), instead you can check if your player is interacting with a Chicken. Also, in your ConditionalSleep, considering it takes time for your player to walk to the chicken, and another player might attack it first, you should check in your sleep condition if the chicken is under attack, or dead etc. Consider this short example (untested): import org.osbot.rs07.api.filter.NameFilter; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Chicken Killer", info = "Kills Chickens...", author = "Explv", version = 0.1, logo = "") public final class ChickenKiller extends Script { private NPC currentChicken; @[member='Override'] public final int onLoop() throws InterruptedException { if(!isAttackingChicken()) attackChicken(); return random(150, 200); } private boolean isAttackingChicken() { return currentChicken != null && currentChicken.exists() && currentChicken.getHealthPercent() > 0 && myPlayer().isInteracting(currentChicken) && currentChicken.isUnderAttack(); } private void attackChicken() { currentChicken = getClosestChicken(); if(currentChicken != null && currentChicken.interact("Attack")) { new ConditionalSleep(5000) { @[member='Override'] public boolean condition() throws InterruptedException { return myPlayer().isInteracting(currentChicken) || !isAttackableTarget(currentChicken); } }.sleep(); } } private NPC getClosestChicken() { return getNpcs().closest( new NameFilter<>("Chicken"), this::isAttackableTarget ); } private boolean isAttackableTarget(final NPC target) { return target != null && target.exists() && target.getHealthPercent() > 0 && !target.isUnderAttack(); } }
  10. Explv replied to Explv's topic in Others
    That's weird, I'll take a look at it, thank you
  11. not centered 0/10
  12. Good job Except for the if if if if if .... You can easily avoid that if you just invert the condition like: if (!script.getTabs().getOpen().equals(Tab.LOGOUT)) { script.getTabs().open(Tab.LOGOUT); return false; }
  13. He was last seen 2014, so I'm not too worried about spam. Inb4 someone makes a new account called FunctionalInterface
  14. This thread is for the developers of the website to see, so don't worry about understanding it....
  15. Yeah... my uh... IDE is doing that...... The problem is, when you try to put the annotation @ Override (without the space) inside of code tags, and then submit your post / edit. @ Override is automatically replaced with that user's name. See this reply in the scripting help section: http://osbot.org/forum/topic/103825-cant-get-conditionalsleep-to-validate/?p=1159828 Note how the accepted solution by Khaleesi has a space between the @ and Override to prevent it from happening.
  16. So this problem is recent, @@OverRideCwalk's name appears instead of the Override annotation inside of the code tags. Consider this simple example: public class Example { @[member='OverRideCwalk'] // This should be @ Override (no space) public String toString() { return "His username messes this up"; } } People are currently working around this issue by putting a space between the @ and the annotation: public class Example { @ Override public String toString() { return "This works fine"; } }
  17. sigh perhaps you should read up on the Java Garbage Collector then. If you are really concerned about memory usage, then perhaps you should use a profiler to see how much memory, and where the memory is being used. It isn't really a concern though. It's just a Map containing a few objects..
  18. The source code is heavily obfuscated, so I wouldn't bother trying to read it. In terms of the getSlot() method, as the API does not specify anything else, it is safe to assume that it would return an index from 0 to the inventory size. Most methods that return some form of index would start at 0, and you know that the inventory has 28 slots. As a valid index would always be positive, -1 is typically used to indicate that a valid index could not be found, you will find this everywhere in programming. Regarding the ordering, you can't know for sure as it's not in the API, but most people would assume left to right in rows. If you don't know exactly how something works, just write a little test and you'll find out.
  19. This is something you could have easily figured out yourself by doing a small amount of testing. The definition of getSlot() looks like: public int getSlot(final Item item) { if(item == null) { return -1; } else { Item[] items = getInventory().getItems(); // returns an array of size 28 for(int i = 0; i < items.length; i++) { if(items[i] != null && items[i].equals(item)) { return i; } } return -1; } } As you can see, if the item is not found it returns -1. Otherwise it returns a value from 0 (inclusive) to 28 (exclusive). 0 is the top left slot, 27 is the bottom right slot. The index increments from left to right: 0 1 2 3 4 5 6 7 8 9 10 11 etc.
  20. Who gives a shit https://www.amazon.co.uk/Logitech-B100-Optical-Mouse-Black/dp/B00AZKNPZC/ref=sr_1_1?s=computers&ie=UTF8&qid=1469914709&sr=1-1&keywords=mouse
  21. In the future please use the code tags when posting code on OSBot. It's the button that looks like <>

Account

Navigation

Search

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.