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.

RSlayer [AIO]

Featured Replies

  • Author

Maybe use ID's instead of item names?

Id's can change depending on updates while names don't.

Really good attempt for a first script! My suggestions would be to clean up your code a lil cos you could simplify a lot of things e.g. When checking for a Glory in your bank you can just use: 

getBank().getItems().stream().filter(item -> item != null && item.getName().contains("Amulet of glory")).collect(Collectors.toList());

That will return all the glories in your bank. Great start though happy.png

Edited by Extreme Scripts

  • Author

Really good attempt for a first script! My suggestions would be to clean up your code a lil cos you could simplify a lot of things e.g. When checking for a Glory in your bank you can just use: 

getBank().getItems().stream().filter(item -> item != null && item.getName().contains("Amulet of glory")).collect(Collectors.toList());

That will return all the glories in your bank. Great start though happy.png

Literally a life saver :doge:

Writing everything out was so annoying.

 

Thanks :3

Really good attempt for a first script! My suggestions would be to clean up your code a lil cos you could simplify a lot of things e.g. When checking for a Glory in your bank you can just use: 

getBank().getItems().stream().filter(item -> item != null && item.getName().contains("Amulet of glory")).collect(Collectors.toList());

That will return all the glories in your bank. Great start though happy.png

Arrays.stream(getBank().getItems()).filter(item -> item.getName().contains("Amulet of glory")).collect(Collectors.toList());

FTFY.

 

getBank().getItems() returns an Item[]

Edited by Explv

Arrays.stream(getBank().getItems()).filter(item -> item.getName().contains("Amulet of glory")).collect(Collectors.toList());

FTFY.

 

getBank().getItems() returns an Item[]

 

Optional<Item> glory = Arrays.stream(getBank().getItems()).filter(i -> i.getName().startsWith("Amulet of glory")).findFirst();

FTFY.

Optional<Item> glory = Arrays.stream(getBank().getItems()).filter(i -> i.getName().startsWith("Amulet of glory")).findFirst();

FTFY.

 

Item glory = getBank().getItem(item -> item.getName().startsWith("Amulet of glory"));

FTFY.

Edited by Explv

Item glory = getBank().getItem(item -> item.getName().startsWith("Amulet of glory"));

FTFY.

 

 

Nope.

Mine is still faster, less expensive and safer.

 

Thank you for playing, please try again!

Edited by Botre

Nope.

Mine is still faster, less expensive and safer.

 

Thank you for playing, please try again!

 

Your opinion.

 

You should learn what premature optimisation is.

 

My solution is better.

 

Thank you for playing, please try again!

Edited by Explv

Your opinion.

 

You should learn what premature optimisation is.

 

My solution is better.

 

Thank you for playing, please try again!

 

Premature optimization is only an anti-pattern if the cost of the optimization outweighs the benefit.

Me picking the best solution over the worse solution in this case and at this point doesn't cost me anything extra because....

 

... I already know the best solution and can implement it as fast if not faster than the lesser solution.

 

Since the optimization didn't cost me anything, the cost can't outweigh the benefit and this is there not a case of antipattern premature optimization but efficient optimization tout-court.

 

*tokens only, push to reject*

 

I'm just playing lel, let's stop this cockfight.

Edited by Botre

for (Item item : script.getInventory().getItems()) {
  if (item != null && item.getName().startsWith("Amulet of glory")) {
    return item;
  }
}

I win for readable oldschool code

Edited by lisabe96

I would still prefer the most readable solution of all:
 

bank.getItem(new ContainsNameFilter<>("Amulet of glory"));

It reads nicely like a sentence and is equal in performance when rounded to nanoseconds.


@OP  Nice script smile.png

Edited by Flamezzz

I would still prefer the most readable solution of all:

 

bank.getItem(new ContainsNameFilter<>("Amulet of glory"));

It reads nicely like a sentence and is equal in performance when rounded to nanoseconds.

@OP  Nice script smile.png

 

But didn't you know you should maximise performance, and minimise readability

 

 

 

 

 

doge.png

Edited by Explv

  • 2 weeks later...

Using the string ("Amulet of glory") will also give you uncharged glory's so wouldn't it be safer to just use ("Amulet of glory (") to at least make sure that there's at least a single charge left in the glory? Not sure if the script doesn't need uncharged glorys but my assumption was that they're used for teleporting.

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.