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. Explv replied to Explv's topic in Others
    Okay thanks, will fix it now.
  2. if(getGroundItems().closest("whatever") != null){ return State.PICK_UP_ITEM; } else if(getNPCs().closest(npcChompBirdAlive) != null){ return State.KILL_CHOMPY; }
  3. I'll make you one boss
  4. Explv replied to Explv's topic in Others
    Don't you need to use shortcuts with climbing boots to get there? I would have to add quite a few things to the script to make that work.
  5. import org.osbot.rs07.api.Widgets; import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.ui.RS2Widget; import java.util.Optional; public class CachedWidget { private int rootID = -1, secondLevelID = -1, thirdLevelID = -1; private String[] widgetTexts; private Filter<RS2Widget> filter; public CachedWidget(final int rootID, final int secondLevelID){ this.rootID = rootID; this.secondLevelID = secondLevelID; } public CachedWidget(final int rootID, final int secondLevelID, final int thirdLevelID){ this.rootID = rootID; this.secondLevelID = secondLevelID; this.thirdLevelID = thirdLevelID; } public CachedWidget(final int rootID, final String... widgetTexts) { this.rootID = rootID; this.widgetTexts = widgetTexts; } public CachedWidget(final String... widgetTexts){ this.widgetTexts = widgetTexts; } public CachedWidget(final int rootID, final Filter<RS2Widget> filter) { this.rootID = rootID; this.filter = filter; } public CachedWidget(final Filter<RS2Widget> filter) { this.filter = filter; } public Optional<RS2Widget> getParent(final Widgets widgets) { return get(widgets).map(widget -> { if (widget.isSecondLevel()) { return widget; } return widgets.get(widget.getRootId(), widget.getSecondLevelId()); }); } public Optional<RS2Widget> get(final Widgets widgets){ if(rootID != -1 && secondLevelID != -1 && thirdLevelID != -1) { return Optional.ofNullable(widgets.get(rootID, secondLevelID, thirdLevelID)); } else if(rootID != -1 && secondLevelID != -1) { return getSecondLevelWidget(widgets); } else if (widgetTexts != null) { return getWidgetWithText(widgets); } else { return getWidgetUsingFilter(widgets); } } private Optional<RS2Widget> getSecondLevelWidget(final Widgets widgets){ RS2Widget rs2Widget = widgets.get(rootID, secondLevelID); if(rs2Widget != null && rs2Widget.isThirdLevel()){ thirdLevelID = rs2Widget.getThirdLevelId(); } return Optional.ofNullable(rs2Widget); } private Optional<RS2Widget> getWidgetWithText(final Widgets widgets){ RS2Widget rs2Widget; if (rootID != -1) { rs2Widget = widgets.getWidgetContainingText(rootID, widgetTexts); } else { rs2Widget = widgets.getWidgetContainingText(widgetTexts); } setWidgetIDs(rs2Widget); return Optional.ofNullable(rs2Widget); } private Optional<RS2Widget> getWidgetUsingFilter(final Widgets widgets) { RS2Widget rs2Widget; if (rootID != -1) { rs2Widget = widgets.singleFilter(rootID, filter); } else { rs2Widget = widgets.singleFilter(widgets.getAll(), filter); } setWidgetIDs(rs2Widget); return Optional.ofNullable(rs2Widget); } private void setWidgetIDs(final RS2Widget rs2Widget) { if (rs2Widget == null) { return; } rootID = rs2Widget.getRootId(); secondLevelID = rs2Widget.getSecondLevelId(); if (rs2Widget.isThirdLevel()) { thirdLevelID = rs2Widget.getThirdLevelId(); } } @Override public String toString() { return rootID + ", " + secondLevelID + ", " + thirdLevelID; } } Usage: private final CachedWidget exampleWidget = new CachedWidget("Blah"); public void someMethod() { exampleWidget.get(getWidgets()).ifPresent(widget -> widget.interact()); }
  6. Are you using an IDE? It should highlight any syntax errors you have
  7. Save this as a .bat file for example osbot.bat: cd C:/Users/%username% for /f "delims=" %%x in ('dir /s /od /b OSBot*.jar') do set recent=%%x java -jar "%recent%" echo %recent% pause Run the .bat file (By double clicking it) This should launch OSBot from CMD. Try to click on the launch button, copy and paste any errors that show up in CMD here. Alternatively, feel free to PM me and I can fix it for you
  8. Maybe something like this? Pseudo Code: If we are chopping a tree: If we have not found another tree: Find another tree Else if we are not hovering over the other tree: Hover over the other tree Else: Chop a tree import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "", name = "", info = "", version = 0.1, logo = "") public class WoodCutter extends Script { private enum State{ CHOPPING, HOVERING } private RS2Object currentTree; private RS2Object hoverTree; private State getState(){ if(currentTree != null && currentTree.exists() && myPlayer().isAnimating()) return State.HOVERING; return State.CHOPPING; } @Override public int onLoop() throws InterruptedException { switch (getState()){ case CHOPPING: chop(); break; case HOVERING: hoverNextTree(); break; } return random(200, 300); } private void chop(){ currentTree = getObjects().closest("Tree"); if(currentTree != null){ currentTree.interact("Chop down"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } private void hoverNextTree(){ if(hoverTree == null || !hoverTree.exists()) { hoverTree = getObjects().closest(obj -> obj.getName().equals("Tree") && obj != currentTree); } else if(!getMouse().isOnCursor(hoverTree)) { hoverTree.hover(); } } } That would only hover over the same tree that you are cutting (the closest one)
  9. Or you know, he could learn Java pls baws
  10. The only reason you will get that errors is because your syntax is incorrect. Doesn't necessarily mean you are missing a ; or have incorrect (). It just means your syntax is fucked Learn Java pls baws
  11. It's likely that in your use cases you will want to be using interact() on whatever you are trying to click. However if you really need to click on a x,y coordinate you will need to use the move method to move the mouse to the correct position, followed by the click method. Or use the click method with a Mouse Destination passed as a parameter. Also, I don't understand why you are trying to click on an Area? If you are trying to walk to an area / position you should use the walking methods
  12. Jesus Christ. It's not like it tells you what the error is or anything.
  13. It might work but you are still doing a lot of things incorrectly
  14. Edited from original comment. Pls learn Java. Why are you doing this in onLoop ?: switch (state) { case CHOP: new Chop(this); break; case DROP: new Drop(this); break; case IN_COMBAT: new InCombat(this); default: break; }
  15. You probably haven't initialised 'state' Programming 101 pls pls
  16. Well that is where your error is then.. Not the GUI. Pls learn how 2 debug pls pls
  17. Probably something else in your code. You should really learn what a NullPointerException is though...
  18. Perhaps you should explain the issue you are having. "webWalk, black line Do not know why" doesn't make much sense. Also, please use the code formatter when submitting code. It is the button that looks like < >
  19. Explv replied to debug's topic in Scripting Help
    If you want to add sleeps then you can do something like: private void dropAll(final String name) throws InterruptedException { for(final Item item : getInventory().getItems()){ if(item.getName().equals(name) && item.interact("drop")){ sleep(random(200, 300)); } } } But I am pretty sure that getInventory().dropAll(itemName) already does sleep a random amount from 25ms to 75ms in between drops.
  20. Explv replied to debug's topic in Scripting Help
    1. You should use .equals() when comparing Strings. == Compares references not the values. 2. You should just use: getInventory().dropAll(itemName); 3. The animating check should not be in that method / doesn't really have any use for determining when you should drop items lol
  21. Explv replied to debug's topic in Scripting Help
    Well your code doesn't make much sense... Why would you call dropAll, a function which DROPS ALL on every single Log in your inventory? It should just be: if (sI.getInventory().isFull()) { sI.getInventory().dropAll("Logs"); }
  22. Explv replied to TFW's topic in Scripting Help
    Why don't you just do: if(npc.getPosition().distance(myPosition()) <= 3) // if npc is less than or equal to 3 tiles away
  23. Hmm, it's not a bad idea, I will think about implementing it. If I do, I will still keep the current tasks, but add this as a new 'custom task' type.
  24. What other stopping conditions / goals would you want?

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.