Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need help dragging item in inventory

Featured Replies

I'm sure I'm just not doing something right. Pretty much just trying to drag a knife to the last inventory slot.
 

public int onLoop() throws InterruptedException {
        if(inventory.contains("Knife")){
            if(inventory.getSlot("Knife") == inventory.getSlot(27)){
                log("We're good.");
            } else {
                MoveKnife();
            }
        }
        return 602;
    }


void MoveKnife() {
        boolean isInPosition = false;
        mouse.continualClick(inventory.getMouseDestination(inventory.getSlot("Knife")), new Condition() {
            @Override
            public boolean evaluate() {
                return isInPosition == true;
            }
        });
        mouse.move(inventory.getMouseDestination(27));
        isInPosition = true;
    }

 

I get a compile error 'local variables referenced from an inner class must be final or effectively final' when building because I'm trying to change isInPosition after moving the mouse. But even if I remove that, all that is happening is the mouse is going click down on the knife and is not moving at all after that. Any help would be appreciated.

Edited by Alakazizam

  • Joubot changed the title to Need help dragging item in inventory
1 hour ago, Alakazizam said:

I'm sure I'm just not doing something right. Pretty much just trying to drag a knife to the last inventory slot.
 

public int onLoop() throws InterruptedException {
        if(inventory.contains("Knife")){
            if(inventory.getSlot("Knife") == inventory.getSlot(27)){
                log("We're good.");
            } else {
                MoveKnife();
            }
        }
        return 602;
    }


void MoveKnife() {
        boolean isInPosition = false;
        mouse.continualClick(inventory.getMouseDestination(inventory.getSlot("Knife")), new Condition() {
            @Override
            public boolean evaluate() {
                return isInPosition == true;
            }
        });
        mouse.move(inventory.getMouseDestination(27));
        isInPosition = true;
    }

 

I get a compile error 'local variables referenced from an inner class must be final or effectively final' when building because I'm trying to change isInPosition after moving the mouse. But even if I remove that, all that is happening is the mouse is going click down on the knife and is not moving at all after that. Any help would be appreciated.

try

	    InventorySlotDestination currItemDestination = new InventorySlotDestination(bot, currentSlot);
            InventorySlotDestination placementDestination = new InventorySlotDestination(bot, mapSlot);

            if (currentSlot != mapSlot) {
                if (bot.getMethods().getMouse().continualClick(currItemDestination, new Condition() {
                    @Override
                    public boolean evaluate() {
                        return bot.getMethods().getMouse().move(placementDestination) && placementDestination.evaluate();
                    }
                })) {
                    //sleep or do something after?
                }
            }

This is an example from my code I use to sort my inventory using a map of items. this is how I get it to drag items around

So mapSlot would be slot 27?

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.