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
  • GameObject question


    Ales

    Recommended Posts

    Is there a better(fastest way) to get object from game instead of using getGameObjects().closest()?  

     

    Sometimes the client is searching for the object for few seconds and therefore making script slower.

     

     

    Ty in advance.

    Link to comment
    Share on other sites

    GameObject door = getGameObjects().closest(p -> p != null && p.getID() == doorEastclosedID);
    

    no but you want to have a filter when looking for game objects. Otherwise i think you are mistaking the script being slow for another part of your programming. That method happens really fast.

    Link to comment
    Share on other sites

    GameObject door = getGameObjects().closest(p -> p != null && p.getID() == doorEastclosedID);
    

    no but you want to have a filter when looking for game objects. Otherwise i think you are mistaking the script being slow for another part of your programming. That method happens really fast.

     

     

    Thanks a lot, how can i change it to yours with this code? not with id but String?

    GameObject fungi = getGameObjects().closest("Fungi on log");
    
    Link to comment
    Share on other sites

     

    Thanks a lot, how can i change it to yours with this code? not with id but String?

    GameObject fungi = getGameObjects().closest("Fungi on log");
    
                GameObject log = getGameObjects().closest(p-> p !=null && p.getName().equals(funginame));
    

    the closest method takes a filter. Now in java 8 you dont have to make a filter you can just use lambda expressions.

     

    Lambdas take the form of (parameter -> expression body)

     

     

    edit sorry you asked for names. i changed the code.

    Link to comment
    Share on other sites

                GameObject log = getGameObjects().closest(p-> p !=null && p.getName().equals(funginame));
    

    the closest method takes a filter. Now in java 8 you dont have to make a filter you can just use lambda expressions.

     

    Lambdas take the form of (parameter -> expression body)

     

     

    edit sorry you asked for names. i changed the code.

     

     

    alright thanks a lot so i assume i have to use .closest twice for one object.? I'll change code of my script later and let you know if speed improved

    Link to comment
    Share on other sites

    alright thanks a lot so i assume i have to use .closest twice for one object.? I'll change code of my script later and let you know if speed improved

    You only need to do it once.

    getGameObjects().closest(item -> item.getName().contains("fungi"));
    
    Link to comment
    Share on other sites

                GameObject log = getGameObjects().closest(p-> p !=null && p.getName().equals(funginame));
    

    the closest method takes a filter. Now in java 8 you dont have to make a filter you can just use lambda expressions.

     

    Lambdas take the form of (parameter -> expression body)

     

     

    edit sorry you asked for names. i changed the code.

     

     

     

    You only need to do it once.

    getGameObjects().closest(item -> item.getName().contains("fungi"));
    

     

    thanks a lot, just tested it is faster

    Link to comment
    Share on other sites

    wot

    you asked for something faster than closest

    and then said closest was faster? :x

     

    i am sorry i just tested script again. Same thing is happening currently. Mouse wouldn't interact with an item fast enough. Usually it takes 2-3 seconds to pick up an item which makes less money/hour. This method hover mouse  next to an item after 3 seconds it hovers on item and clicks it and repeats. 

    I want something that would hover mouse over item and click almost instantaneously.

    Here is my method, any help would be appreciated.

     

    public void picking() {
    GameObject log = getGameObjects().closest(item -> item !=null && item.getName().contains("Fungi on log"));
    //GameObject log = getGameObjects().closest(p -> p != null && p.getName().equals(fungi));
    log.interact("Pick");  
    // move Camera or missclick fungi.!
    }
    Link to comment
    Share on other sites

     

    i am sorry i just tested script again. Same thing is happening currently. Mouse wouldn't interact with an item fast enough. Usually it takes 2-3 seconds to pick up an item which makes less money/hour. This method hover mouse  next to an item after 3 seconds it hovers on item and clicks it and repeats. 

    I want something that would hover mouse over item and click almost instantaneously.

    Here is my method, any help would be appreciated.

     

    public void picking() {
    GameObject log = getGameObjects().closest(item -> item !=null && item.getName().contains("Fungi on log"));
    //GameObject log = getGameObjects().closest(p -> p != null && p.getName().equals(fungi));
    log.interact("Pick");  
    // move Camera or missclick fungi.!
    }

     

    ...what are you running this script on for that to take a few seconds >_>

    Link to comment
    Share on other sites

    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.