Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Highlighting Multiple NPCs Issue


    tysonn

    Recommended Posts

    Posted

    Hey guys, 

     

    I am trying to create a small power fisher while I do some other work and I am trying to highlight all the npcs around me.

     can highlight the npcs just fine using 

    getNpcs().closest("Fishing spot")

    but obviously that just highlights the closest spot, I am trying to highlight all shark spots (that have option Net instead of Cage) but when I use something like

    for (NPC n : getNpcs().all(1511))
        g.drawPolygon(n.getTile().getPolygon());

    it just freezes the entire screen and client until I stop the script. Am I doing something wrong? Somebody please point me in the right direction. Thanks!

     

    Nevermind, I fixed it. Had to make sure that the NPC was actually visible on the screen before trying to draw it's polygon.

    Posted

    It might be helpful to store the polygons in a different loop, instead of onPaint(). That way you're not going to destroy your CPU by having it do all those calculations 1000 times per second...

     

    Try doing something like this:
     

    //Global variable
    private List<Polygon> polygonList;
    
    //Put this in your onLoop()
    polygonList = getNpcs().all(1511).stream().map(n -> n.getTile().getPolygon()).collect(Collectors.toList());
    
    //Put this in your onPaint()
    for(Polygon p : polygonList)
        g.drawPolygon(p);
    

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.