Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

How do filters work?

Joined
Jul 17, 2014
Messages
9
Hi,

Sorry to ask such a vague question but I see them about a bit but not sure what they really are, when is best to use them and how exactly to use them. I'm not expecting a full blown guide but maybe a little example then I can take it from there.

Many thanks!
 
Joined
Dec 10, 2014
Messages
3,332
The accept method in a filter determines whether to keep that object or not, if accept returns true it's kept, if it returns false it is removed.

They can be used for stuff like, filtering out Npcs that are already in combat, either by checking if they have a health gauge, or have a target, or are being targeted.
 
Joined
Jul 17, 2014
Messages
9
Ah ok awesome, I just got tied up a bit because I saw the usual way to get objects then I saw the filter method and thought to myself which way is better - but I see now each one has its uses in certain circumstances. Thank you :)
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,053
@Zallen93 If you're developing for RuneMate or are generally a fun guy who's interested in programming you should highly consider joining our Skype dev chat. We would have answered your question within seconds. Hit me up with your Skype via PM if you're interested. :)
 
Joined
Mar 26, 2014
Messages
33
@Zallen93 If you're developing for RuneMate or are generally a fun guy who's interested in programming you should highly consider joining our Skype dev chat. We would have answered your question within seconds. Hit me up with your Skype via PM if you're interested. :)

One question i have is since the client supports java 8 and its actually recommended. Why is there a seperate filter, sort and query api, instead of using generic collections classes and let the scripter use the new collections streams api?
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,053
One question i have is since the client supports java 8 and its actually recommended. Why is there a seperate filter, sort and query api, instead of using generic collections classes and let the scripter use the new collections streams api?
The query API was developed before we started forcing Java 8. @Cloud can speak on the merits of the query API over standard streams.
 
Top