Ales 2 Posted October 24, 2015 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.
RealEngine 24 Posted October 24, 2015 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.
Ales 2 Author Posted October 24, 2015 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");
RealEngine 24 Posted October 24, 2015 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.
Ales 2 Author Posted October 24, 2015 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
Dreamlicker 750 Posted October 24, 2015 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 improvedYou only need to do it once. getGameObjects().closest(item -> item.getName().contains("fungi"));
Ales 2 Author Posted October 24, 2015 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
Nuclear Nezz 2107 Posted October 24, 2015 wot you asked for something faster than closest and then said closest was faster? :x
Ales 2 Author Posted October 24, 2015 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.! }
Nuclear Nezz 2107 Posted October 24, 2015 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 >_>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.