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.

How can i use ids instead of string names

Featured Replies

I am trying to make a simple agility script for Faldor which has two consecutive "Jump Ledges" and the bot currently chooses the previous one as its the closest whern using

 

private String[] names = {"Rough wall", "Tightrope", "Hand holds", "Gap", "Gap", "Tightrope","Tightrope","Gap","Ledge","Ledge","Ledge","Ledge","Edge"};
//    private int[] names = {14898, 14899, 14901, 14903, 14904, 14905,14911,14919,14920,14921,14923,14924,149251};
    Entity previous;

    @Override
    public void onStart() {
        getExperienceTracker().start(Skill.AGILITY);
    }

    @Override
    public int onLoop() throws InterruptedException {
        int starting = getExperienceTracker().getGainedXP(Skill.AGILITY);
        Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) &&
                Arrays.asList(actions).contains(obj.getActions()[0]) &&
                (getMap().canReach(obj)) &&
                !obj.equals(previous));
        log(nextObj.getId());

 

I am trying to implement the array of ids and have tried

 

Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getId()) && Arrays.asList(actions).contains(obj.getActions()[0]) && (getMap().canReach(obj)) && !obj.equals(previous)); However it just creates nulls and breaks the script i was wondering how can i overcome this / the best way to achieve this.

You can differentiate between them by the position of the object

For example, one ledge is at Position(3011, 3343, 3), and the following is at Position(3012, 3334, 3)

Ids, work exactly the same as names tbh, but that's most likely not going to solve your issue

Make like an Enum with an RooftopArea + Object name + position + action and use that instead :)
Add some area checks in there to know which roof you are on and which object to interact with so you can control what's going on.

Edited by Khaleesi

  • Author
On 8/11/2023 at 8:39 PM, Khaleesi said:

Ids, work exactly the same as names tbh, but that's most likely not going to solve your issue

Make like an Enum with an RooftopArea + Object name + position + action and use that instead :)
Add some area checks in there to know which roof you are on and which object to interact with so you can control what's going on.

Hi Thanks for the reply I actually managed to solve it by doing this getObjects().closest(obj -> Arrays.asList(ids).contains(Integer.toString(obj.getId())) and then making it an array of strings instead I'm not really sure why it wouldn't work with ints but there we go

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

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.