The client is offline due to RuneScape update. You may see instance errors but this is due to the update and not actual instance errors. This should be resolved soon. Join our Discord for more information.

Filter



  • Im porting some my old scripts i pulled from a drive, now back in rsbot we used filter


    public Filter<Npc> filter = new Filter<Npc>(){
    @Override
    public boolean accept(Npc t) {
    if(!t.isInCombat() && MethodCollection.isInCombatZone(t.getPosition()) && t.getHealthPercent() > 0){
    for(Monster npc : SettingDatabase.Npcs) {
    if (npc.getId() == t.getId()) {
    return true;
    }
    }
    }
    return false;
    }

    };
    

    is the method im talking about, whats the equilivant of buldigf this to rspeers api?

    Npc filter Npcs.getNearest(filter);

    thanks


  • Contributor Sponsor Staff Director

    Predicate is an interface introduced in Java 8. You can use this.



  • You use a predicate, so something like:

    Npcs.getNearest(i -> i.getName.contains(s) && i.distance(p) < X) etc..


 

58
Online

15.4k
Users

1.3k
Topics

18.6k
Posts