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.

Explv

Scripter II
  • Joined

  • Last visited

Everything posted by Explv

  1. Explv replied to kadiem's topic in Scripting Help
    You can only create files in the OSBot data directory. The path for this directory can be retrieved using getDirectoryData(), I think it's in the Script class?
  2. Indian burns all up on a niga wee-wee
  3. Sorry, I have been on vacation. I do try to fix bugs as they appear. You must understand that this is a massive script, and things do break, it is difficult for me to test absolutely everything myself. A lot of things do work, and I will keep trying to resolve issues that you find. Things may not get fixed instantly, but you should remember that I make no money from this project, and I do have other things going on in my life. That being said, I will try to take a look at these issues over the next few days, now that I am back home. Thanks
  4. Explv replied to kadiem's topic in Scripting Help
    If it is your own script, just write to a file instead of the logger. If it isn't, you could run the bot via the command line in debug mode using the -debug flag and then redirect the output to a file by using > logfile.txt at the end of the command. java -jar ....... -debug ..... > logfile.txt
  5. Sorry to be a hater but using null (absolute) layout, and setting fixed sizes for everything is very bad practice. You should be using a layout manager. Class names should start with a capital letter. Instead of passing a reference to your main class, you should just have getters in your GUI to return desired values.
  6. You could try doing something like: Optional<Item> glory = Arrays.stream(getBank().getItems()).filter(item -> item.getName().startsWith("Amulet of glory(")).min((g1, g2) -> g1.getName().compareTo(g2.getName())) Sorry for any syntax errors, on phone
  7. It returns a List<NPC> and you're storing it just as a List. You need to specify the type: List<NPC> npcs = getNpcs().filter(myFilter); Also no need to define your own Filter for this, OSBot already has predefined ones: getNpcs().closest(new NameFilter<>("NPC Name"), new AreaFilter<>(myArea)); Or if you don't care about whether it is the closest one: getNpcs().singleFilter(getNpcs().getAll(), new NameFilter<>("NPC Name"), new AreaFilter<>(myArea));
  8. @XaLeR Looks like maybe you could make use of the spell name field of the widget? RS2Widget goldBraceletWidget = getWidgets().singleFilter(getWidgets().getAll(), w -> w.getSpellName().contains("Gold bracelet"));
  9. It's not an issue, you can do what you want, doesn't mean i'm not allowed to think its weird. And I don't see why me thinking its stupid to travel 12 hours to see a solar eclipse makes me immature.
  10. Explv replied to Explv's topic in Snippets
    There is, I just wanted to write it in my own style, without passing MethodProvider as a constructor argument, with a few extra constructors, and without having to explicitly call cache() before getWidget(). I could have just extended yours, but whatever.
  11. Explv replied to Explv's topic in Snippets
    Wow, TIL, I had no idea osrs had chatbox commands. Thanks kiddo
  12. Yeah dude once a lifetime
  13. You're driving 12 hours... To see a solar eclipse... Wow bro 5 minutes of darkness this is so litttttttttt
  14. Explv replied to Arctic's topic in Spam/Off Topic
  15. It probably shouldn't be. It's marked as internal use only, but l use it in my scripts anyway.
  16. By starting OSBot with the CLI flag -allow norandoms
  17. Explv posted a topic in Snippets
    This makes use of my CachedWidget class: https://osbot.org/forum/topic/97399-a-better-way-to-handle-widgets-cachedwidget/ And also my WidgetActionFilter class: https://osbot.org/forum/topic/127248-widget-action-filter/ import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.event.Event; public final class DisableAudioEvent extends Event { private static final int musicVolumeConfig = 168; private static final int soundEffectVolumeConfig = 169; private static final int areaSoundEffectVolumeConfig = 872; private final CachedWidget soundSettingsWidget = new CachedWidget(new WidgetActionFilter("Audio")); private final CachedWidget musicVolumeWidget = new CachedWidget(new WidgetActionFilter("Adjust Music Volume")); private final CachedWidget soundEffectVolumeWidget = new CachedWidget(new WidgetActionFilter("Adjust Sound Effect Volume")); private final CachedWidget areaSoundEffectVolumeWidget = new CachedWidget(new WidgetActionFilter("Adjust Area Sound Effect Volume")); @Override public final int execute() throws InterruptedException { if (Tab.SETTINGS.isDisabled(getBot())) { setFailed(); } else if (getTabs().getOpen() != Tab.SETTINGS) { getTabs().open(Tab.SETTINGS); } else if (!musicVolumeWidget.get(getWidgets()).isPresent()) { soundSettingsWidget.get(getWidgets()).ifPresent(widget -> widget.interact()); } else if (!isVolumeDisabled(musicVolumeConfig)) { musicVolumeWidget.get(getWidgets()).ifPresent(widget -> widget.interact()); } else if (!isVolumeDisabled(soundEffectVolumeConfig)) { soundEffectVolumeWidget.get(getWidgets()).ifPresent(widget -> widget.interact()); } else if (!isVolumeDisabled(areaSoundEffectVolumeConfig)) { areaSoundEffectVolumeWidget.get(getWidgets()).ifPresent(widget -> widget.interact()); } else { setFinished(); } return 200; } private boolean isVolumeDisabled(final int config) { return getConfigs().get(config) == 4; } } Usage: Event disableAudioEvent = new DisableAudioEvent(); execute(disableAudioEvent);
  18. Alternative much simpler snippet provided by @Deceiver getKeyboard().typeString("::toggleroofs"); If you still want to use the widget interaction way: This makes use of my CachedWidget class: https://osbot.org/forum/topic/97399-a-better-way-to-handle-widgets-cachedwidget/ And also my WidgetActionFilter class: https://osbot.org/forum/topic/127248-widget-action-filter/ import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.event.Event; public final class ToggleRoofsHiddenEvent extends Event { private final CachedWidget advancedOptionsWidget = new CachedWidget("Advanced options"); private final CachedWidget displaySettingsWidget = new CachedWidget(new WidgetActionFilter("Display")); private final CachedWidget toggleRoofHiddenWidget = new CachedWidget(new WidgetActionFilter("Roof-removal")); @Override public final int execute() throws InterruptedException { if (Tab.SETTINGS.isDisabled(getBot())) { setFailed(); } else if (getTabs().getOpen() != Tab.SETTINGS) { getTabs().open(Tab.SETTINGS); } else if (!advancedOptionsWidget.get(getWidgets()).isPresent()) { displaySettingsWidget.get(getWidgets()).ifPresent(widget -> widget.interact()); } else if (!toggleRoofHiddenWidget.get(getWidgets()).isPresent()) { advancedOptionsWidget.get(getWidgets()).get().interact(); } else if (toggleRoofHiddenWidget.get(getWidgets()).get().interact()) { setFinished(); } return 200; } } Usage: if (!getSettings().areRoofsEnabled()) { Event toggleRoofsHiddenEvent = new ToggleRoofsHiddenEvent(); execute(toggleRoofsHiddenEvent); }
  19. Explv posted a topic in Snippets
    import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.ui.RS2Widget; public final class WidgetActionFilter implements Filter<RS2Widget> { private final String[] actions; public WidgetActionFilter(final String... actions) { this.actions = actions; } @Override public final boolean match(final RS2Widget rs2Widget) { if (rs2Widget == null || !rs2Widget.isVisible() || rs2Widget.getInteractActions() == null) { return false; } for (final String widgetAction : rs2Widget.getInteractActions()) { for (final String matchAction : actions) { if (matchAction.equals(widgetAction)) { return true; } } } return false; } }
  20. You should be demoted REEEEEEEEEE
  21. import org.osbot.rs07.utility.ConditionalSleep; import java.util.function.BooleanSupplier; public final class Sleep extends ConditionalSleep { private final BooleanSupplier condition; public Sleep(final BooleanSupplier condition, final int timeout) { super(timeout); this.condition = condition; } public Sleep(final BooleanSupplier condition, final int timeout, final int interval) { super(timeout, interval); this.condition = condition; } @Override public final boolean condition() throws InterruptedException { return condition.getAsBoolean(); } public static boolean sleepUntil(final BooleanSupplier condition, final int timeout) { return new Sleep(condition, timeout).sleep(); } public static boolean sleepUntil(final BooleanSupplier condition, final int timeout, final int interval) { return new Sleep(condition, timeout, interval).sleep(); } } Usage: Sleep sleep = new Sleep(() -> myPlayer().isAnimating(), 5000); sleep.sleep(); Or: Sleep.sleepUntil(() -> myPlayer().isAnimating(), 5000);
  22. You can create a custom event and disable camera operation: https://osbot.org/api/org/osbot/rs07/event/InteractionEvent.html#setOperateCamera-boolean- InteractionEvent interactionEvent = new InteractionEvent(entity, "Attack"); interactionEvent.setOperateCamera(false); execute(interactionEvent);
  23. You can use the modified colours of the object to check if the rock has ore. Here is an enum I already created: public enum Rock { CLAY(6705), COPPER(4645), TIN(53), IRON(2576), SILVER(74), COAL(10508), GOLD(8885), MITHRIL(-22239), ADAMANTITE(21662), RUNITE(-31437); private final short COLOUR; Rock(final int COLOUR) { this.COLOUR = (short) COLOUR; } public boolean hasOre(final RS2Object object){ if (object == null || object.getModifiedColors() == null || !"Rocks".equals(object.getName())) { return false; } for(final short colour : object.getDefinition().getModifiedModelColors()){ if(colour == this.COLOUR) { return true; } } return false; } } You can then use it like so: RS2Object currentRock; @Override public final int onLoop() throws InterruptedException { if (!myPlayer().isAnimating() || !Rock.TIN.hasOre(currentRock)) { mine(); } return 200; } private void mine() { currentRock = getObjects().closest(obj -> Rock.TIN.hasOre(obj)); if (currentRock != null && currentRock.interact("Mine")) { new ConditionalSleep(5000) { @Override public boolean condition() { return myPlayer().isAnimating() || !Rock.TIN.hasOre(currentRock); } }.sleep(); } } Sorry if there are any syntax errors, i'm just leaving work. Will check it when i'm home.
  24. I think it's because the conditional sleep blocks the thread, and so onMessage isn't called until it finishes. Pretty sure ConditonalSleep doesn't cache anything because that would kind of defeat the point...
  25. I can do yeah. Will take a look tonight or tomorrow

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.