Jump to content

Strange functionality with Camera rotations & Ground items.


Impensus

Recommended Posts

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 by Impensus
Updated
Link to comment
Share on other sites

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 by Czar
  • Like 1
Link to comment
Share on other sites

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! :)

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...