yfoo Posted November 16, 2023 Share Posted November 16, 2023 Lets say I query for some Entity and store it to a variable. List<RS2Object> visibleTrees1 = objects.filter( new ContainsNameFilter<>("tree"), rs2Object -> !rs2Object.getName().contains("Tree stump") && rs2Object.isVisible() && myPlayer().getPosition().distance(rs2Object.getPosition()) <= 5 ); Rs2Object myReference = visibleTrees.get(0); For how long is that instance (myReference) valid for interaction events? If I leave the area and come back, can I still use the instance I queried before? Or has it gone stale and need to be re-queried? Quote Link to comment Share on other sites More sharing options...
yfoo Posted November 16, 2023 Author Share Posted November 16, 2023 (edited) I think the answer is until I walk far enough to hit a loading screen. The RS would get the set of objects in the newly loaded game area which would then be intercepted by osbot and made available through the api. The instances from the previous area would be available to the JVM for garbage collection. Going to test that hypothesis Edited November 16, 2023 by PayPalMeRSGP Quote Link to comment Share on other sites More sharing options...
yfoo Posted November 16, 2023 Author Share Posted November 16, 2023 45 minutes ago, PayPalMeRSGP said: I think the answer is until I walk far enough to hit a loading screen. The RS would get the set of objects in the newly loaded game area which would then be intercepted by osbot and made available through the api. The instances from the previous area would be available to the JVM for garbage collection. Going to test that hypothesis Seems the be the case. I walk away, trigger a load then the hashcode of the instance changes when I come back. [INFO][Bot #1][11/15 09:09:19 PM]: Querying Entity [INFO][Bot #1][11/15 09:09:19 PM]: org.osbot.rs07.api.model.InteractableObject@60beb29d [INFO][Bot #1][11/15 09:09:19 PM]: Optional[org.osbot.rs07.api.model.Model@52697857] Walk and return... [INFO][Bot #1][11/15 09:10:05 PM]: Querying Entity [INFO][Bot #1][11/15 09:10:05 PM]: org.osbot.rs07.api.model.InteractableObject@856ac72 [INFO][Bot #1][11/15 09:10:05 PM]: Optional[org.osbot.rs07.api.model.Model@f00a947] Same situation for if the entity is consumed (Tree chopped) Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted November 16, 2023 Share Posted November 16, 2023 (edited) 2 hours ago, PayPalMeRSGP said: Lets say I query for some Entity and store it to a variable. List<RS2Object> visibleTrees1 = objects.filter( new ContainsNameFilter<>("tree"), rs2Object -> !rs2Object.getName().contains("Tree stump") && rs2Object.isVisible() && myPlayer().getPosition().distance(rs2Object.getPosition()) <= 5 ); Rs2Object myReference = visibleTrees.get(0); For how long is that instance (myReference) valid for interaction events? If I leave the area and come back, can I still use the instance I queried before? Or has it gone stale and need to be re-queried? Until it unloads or if it's not there anymore I believe Edited November 16, 2023 by Khaleesi Quote Link to comment Share on other sites More sharing options...