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.

Abort offer if it has ... status

Featured Replies

Simple snippet to abort all offers if they have status x.

    private boolean toAbortOffers() {
        return !getWidgets().containingActions(465,"Abort offer").isEmpty();
    }

    private void abortOffers() throws InterruptedException {
        if (toAbortOffers()) {
            ArrayList<RS2Widget> toAbort = (ArrayList<RS2Widget>) getWidgets().containingActions(465,"Abort offer");
            for (int i = 0; i < toAbort.size(); i++) {
                toAbort.get(i).interact("Abort offer");
                int finalI = i;
                new ConditionalSleep(10000) {
                    @Override
                    public boolean condition() {
                        return Arrays.asList(toAbort.get(finalI).getInteractOptions()).contains("Abort offer");
                    }
                }.sleep();
            }
            sleep(random(800,1200));
            getGrandExchange().collect();
        }
    }

If you see any improvements I could make, don't hesitate to comment.

 

https://gyazo.com/bf50191011b0d8fd69b67ae4ea55da53

Edited by The Undefeated

If you are looking for improvements I guess you could start by removing any constant number that you can't justify ("magic numbers" in programming), I see at least 4 of them in the 2nd method, and another 2 which will make your code unstable

  • Author
1 minute ago, Token said:

If you are looking for improvements I guess you could start by removing any constant number that you can't justify ("magic numbers" in programming), I see at least 4 of them in the 2nd method, and another 2 which will make your code unstable

 G.E. Box 1 has widget number 7, Box 2 has 8 etc. That's why.

 

Just now, The Undefeated said:

 G.E. Box 1 has widget number 7, Box 2 has 8 etc. That's why.

 

That's 1 of the 2 which makes your code unstable

  • Author
Just now, Token said:

That's 1 of the 2 which makes your code unstable

Please tell me how I could improve that?

Other one must be the static widget (Which is almost impossible to replace or the sleep.

 

Just now, The Undefeated said:

Please tell me how I could improve that?

Other one must be the static widget (Which is almost impossible to replace or the sleep.

 

I don't see why it's impossible to replace, the id is just one of the many properties a RS2Widget object has. Take a look through all methods, there's at least 10 different ways of identifying a widget and id is only 1 of them (easiest and worst at the same time) https://osbot.org/api/org/osbot/rs07/api/ui/RS2Widget.html

eg: filter by actions, filter by position, filter by message, filter by color BUT NOT filter by id. The simple reason behind this is the properties I mentioned are all exposed to the human player, while abstract numbers such as ids and indexes are not visible to normal players, and jagex can change them whenever they want without affecting the legit players. They do this about once a month for the tutorial island widgets just to break all scripts coded by people who use these properties. 

As for the sleeps, if I ask you why 300 and not 301, and you can't give a serious answer to this, then it is an obviously flawed logic. A better approach would be waiting until something happens aka conditional sleep.

Just now, Token said:

As for the sleeps, if I ask you why 300 and not 301, and you can't give a serious answer to this, then it is an obviously flawed logic. A better approach would be waiting until something happens aka conditional sleep.

300 looks better than 301, shaboom.

Srslly tho, what token said.

  • Author
1 hour ago, Token said:

I don't see why it's impossible to replace, the id is just one of the many properties a RS2Widget object has. Take a look through all methods, there's at least 10 different ways of identifying a widget and id is only 1 of them (easiest and worst at the same time) https://osbot.org/api/org/osbot/rs07/api/ui/RS2Widget.html

eg: filter by actions, filter by position, filter by message, filter by color BUT NOT filter by id. The simple reason behind this is the properties I mentioned are all exposed to the human player, while abstract numbers such as ids and indexes are not visible to normal players, and jagex can change them whenever they want without affecting the legit players. They do this about once a month for the tutorial island widgets just to break all scripts coded by people who use these properties. 

As for the sleeps, if I ask you why 300 and not 301, and you can't give a serious answer to this, then it is an obviously flawed logic. A better approach would be waiting until something happens aka conditional sleep.

Thanks for clearing this up, I improved it. Only part I don't like is the sleep before collecting. If I don't add it, the last 1-2 items that were aborted won't be collected.

And it also presses the same exact position on all of the boxes.

 

 

Edited by The Undefeated

No point using a List when you are using it like an Array.

  • 3 weeks later...

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.