Impensus Posted May 12, 2019 Share Posted May 12, 2019 (edited) Hi guys, I am occasionally having strange interactions with getting ground items and camera rotations which I have not been able to pinpoint the reasoning for. What is happening is that when I go to pick up a stack of items below me occasionally the camera will rotate constantly while trying to pick up and move to a weird spot. The script will then idle for 5/10 seconds and then try banking (will sometimes get the bank option or missclick on the teller). After this idle it will bank the items and find them on the floor afterwards but the wasted time is what is the issue. The snippet of code is as follows: if (getGroundItems().groundItems.closest("Item name here") != null){ log("Found some items went to the floor"); int x = myPlayer().getX(); int y = myPlayer().getY(); for (GroundItem g : getGroundItems().filter(getGroundItems().get(x, y), new NameFilter<>("Item name here"))){ log("Picking up floor item"); if (g != null && g.exists()){ Long invitemnameamount = getInventory().getAmount("Item name here"); g.interact("Take"); new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return getInventory().getAmount("Item name here") == invitemnameamount+1; } }.sleep(); } } } Replaced variables & strings so they do not show item names. You get the idea. Thank you for any help! Edited May 12, 2019 by Impensus Updated Quote Link to comment Share on other sites More sharing options...
Czar Posted May 12, 2019 Share Posted May 12, 2019 (edited) Hmm try changing the filters around so it will be more specific: NameFilter<GroundItem> nameFilter = new NameFilter<>("item name here"); getGroundItems().filter(a -> a.getX() == x && a.getY() == y && nameFilter.match(a)); As for the time, change the conditional sleep so: int expiredAmount = (int) getInventory().getAmount("Item name here"); new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return ((int) getInventory().getAmount("Item name here")) != expiredAmount; } }.sleep(); This will make it so the sleep depends on if the amount changed at all, instead of if the amount has been added by 1. If you want the script to not move the camera you must use InteractionEvent and disable the camera, I will try and find a link somewhere to an osbot thread with help. Edited May 12, 2019 by Czar 1 Quote Link to comment Share on other sites More sharing options...
Impensus Posted May 12, 2019 Author Share Posted May 12, 2019 11 minutes ago, Czar said: Hmm try changing the filters around so it will be more specific: NameFilter<GroundItem> nameFilter = new NameFilter<>("item name here"); getGroundItems().filter(a -> a.getX() == x && a.getY() == y && nameFilter.match(a)); As for the time, change the conditional sleep so: int expiredAmount = (int) getInventory().getAmount("Item name here"); new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return ((int) getInventory().getAmount("Item name here")) != expiredAmount; } }.sleep(); This will make it so the sleep depends on if the amount changed at all, instead of if the amount has been added by 1. If you want the script to not move the camera you must use InteractionEvent and disable the camera, I will try and find a link somewhere to an osbot thread with help. Okay thank you for your help Czar! I will make these changes now, the link would be useful too! 1 Quote Link to comment Share on other sites More sharing options...
zwaffel Posted May 12, 2019 Share Posted May 12, 2019 I recently had this problem aswell i fixed it by making a custom InteractionEvent for it InteractionEvent take = new InteractionEvent(item, "Take"); take.setOperateCamera(false); if (!getInventory().isFull()) execute(take); 2 Quote Link to comment Share on other sites More sharing options...
Impensus Posted May 12, 2019 Author Share Posted May 12, 2019 6 minutes ago, zwaffel said: I recently had this problem aswell i fixed it by making a custom InteractionEvent for it InteractionEvent take = new InteractionEvent(item, "Take"); take.setOperateCamera(false); if (!getInventory().isFull()) execute(take); Thank you Quote Link to comment Share on other sites More sharing options...