Butters Posted January 11, 2018 Share Posted January 11, 2018 (edited) I''m failing to find a way how to get a bunch of objects in a given slightly bigger area. It isn't really that big : x cord span: 38 y cord span: 45. When using methods like List<RS2Object> openableDoors = s.objects.getAll().stream().filter(f -> f.getName().equals("Door") && f.hasAction("Open")).collect(Collectors.toList()); or List<RS2Object> objList = s.objects.filter(f -> f.getName().equals(objectName) && f.hasAction(objectAction)); if (!objList.isEmpty()) { RS2Object lever = objList.get(0); // Do stuff } else { s.log("Couldn't find object: " + objectName); } I was hoping that this gives me all the objects that are loaded in region. (The objects exists and actually are visible) When I manually walk a lil closer to the object I want to interact, the script finds the object. I have a hunch that these methods have a "max search distance" or something. Anyway to get a full list of objects loaded or in a given (a lil bigger) area? Edited January 11, 2018 by nosepicker Quote Link to comment Share on other sites More sharing options...
Chris Posted January 11, 2018 Share Posted January 11, 2018 area.contains(f.getposition) ? Quote Link to comment Share on other sites More sharing options...
Butters Posted January 11, 2018 Author Share Posted January 11, 2018 (edited) 2 minutes ago, Chris said: area.contains(f.getposition) ? This should "slim down" the possible results, not expand the search area Edited January 11, 2018 by nosepicker Quote Link to comment Share on other sites More sharing options...
WhoKnew Posted January 11, 2018 Share Posted January 11, 2018 7 minutes ago, nosepicker said: This should "slim down" the possible results, not expand the search area You could just define a huge area? From what it looks like you are doing, it'll work with what you are trying to do. Looks like you are just trying to find a door Quote Link to comment Share on other sites More sharing options...
Butters Posted January 11, 2018 Author Share Posted January 11, 2018 31 minutes ago, WhoKnew said: You could just define a huge area? From what it looks like you are doing, it'll work with what you are trying to do. Looks like you are just trying to find a door What difference should it bring in just "finding an object that I can see". Atm I don't care if the object I want in the area I want, could be X other objects outside my desired area The problem I'm facing is that the script doesn't find the object even when I see it (from far away - maybe like 15-20 or so tiles). After playing around noticed that if I rotate the camera a lil towards the object, the script finds the object. Apart from adding failsafes like rotate camera or walk around, any bulletproof ways to do this? Quote Link to comment Share on other sites More sharing options...
d0zza Posted January 11, 2018 Share Posted January 11, 2018 The game only loads objects up to 15 tiles away from your player so you won't be able to get all the objects in an area that big. Quote Link to comment Share on other sites More sharing options...
Butters Posted January 12, 2018 Author Share Posted January 12, 2018 7 hours ago, El_Maestro said: Trying running your current snippet from the same game position twice. Print how many objects you find. If something is wrong it should print a different number every run. Running this every loop iteration. Will try to see the size of the returned list, thanks! 6 hours ago, d0zza said: The game only loads objects up to 15 tiles away from your player so you won't be able to get all the objects in an area that big. Thanks for the info. But isn't there something like a "loaded region"? Should be bigger than 15 tiles Also when I see the object in the distance I can right click on it and interact with it, so it's loaded in game, but the script has trouble finding it Quote Link to comment Share on other sites More sharing options...
IDontEB Posted January 12, 2018 Share Posted January 12, 2018 6 hours ago, d0zza said: The game only loads objects up to 15 tiles away from your player so you won't be able to get all the objects in an area that big. Are you sure that's true? at ZMI you can click on the alter when you're over 15 tiles away easily. Quote Link to comment Share on other sites More sharing options...
Butters Posted January 12, 2018 Author Share Posted January 12, 2018 21 minutes ago, El_Maestro said: The game is loading, I think the api method may just have a preset distance cap because you don't usually need anything bigger. I've always noticed that it only gets npcs that are on your minimap. This minimap thing might be the case. Will test to confirm. Though if it's true, any methods to load beyond minimap? Quote Link to comment Share on other sites More sharing options...
Ayylmao420 Posted January 12, 2018 Share Posted January 12, 2018 getObjects().getAll() returns all objects in your loaded region, you're obviously doing something wrong here. Quote Link to comment Share on other sites More sharing options...
dreameo Posted January 12, 2018 Share Posted January 12, 2018 https://imgur.com/a/MGZZW l0l Quote Link to comment Share on other sites More sharing options...
Butters Posted January 12, 2018 Author Share Posted January 12, 2018 55 minutes ago, dreameo said: https://imgur.com/a/MGZZW l0l Try to stand further away from your object until it's not visible in minimap and tell me how it goes What I noticed though: 1) Object must be on minimap to be found (after login). If it was on minimap earlier, then it can be found later without problems. 2) Methods closest(Area, objectName), getAll() adhere to the 1st rule. Quote Link to comment Share on other sites More sharing options...
dreameo Posted January 12, 2018 Share Posted January 12, 2018 41 minutes ago, nosepicker said: Try to stand further away from your object until it's not visible in minimap and tell me how it goes What I noticed though: 1) Object must be on minimap to be found (after login). If it was on minimap earlier, then it can be found later without problems. 2) Methods closest(Area, objectName), getAll() adhere to the 1st rule. I've had issues before with getObjects() in general. It picked up things that aren't actually there. Hence when I tested out the max tile distance, I got 73 (Logged in and testing where I stood - didn't move). If objects aren't being loaded because they are too far, not sure if there's anything that you could even do about it lol. Play around and do some tests Quote Link to comment Share on other sites More sharing options...
Butters Posted January 12, 2018 Author Share Posted January 12, 2018 11 minutes ago, dreameo said: I've had issues before with getObjects() in general. It picked up things that aren't actually there. Hence when I tested out the max tile distance, I got 73 (Logged in and testing where I stood - didn't move). If objects aren't being loaded because they are too far, not sure if there's anything that you could even do about it lol. Play around and do some tests 73 Tiles? Quite a lot. I test by completely relaunching the client, so should be fresh cache. Anyway, "solved" the issue by first traveling around the area for all objects to load properly. All works as expected after this. Quote Link to comment Share on other sites More sharing options...
dreameo Posted January 12, 2018 Share Posted January 12, 2018 2 minutes ago, nosepicker said: 73 Tiles? Quite a lot. I test by completely relaunching the client, so should be fresh cache. Anyway, "solved" the issue by first traveling around the area for all objects to load properly. All works as expected after this. Hmmm wouldn't it just save a cache of the objects? If they are dynamic objects, then it wouldn't be that much of a solution. Quote Link to comment Share on other sites More sharing options...