Jump to content

RSlayer [AIO]


Salty as fuck

Recommended Posts

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
  • Like 2
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 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.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...