Skip 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.

Why is there no item.interact()

Featured Replies

I understand that there is one in the inventory class, but that's pretty stupid considering that all the entities have interaction methods.

 

package org.kenneh.scripts;

import org.kenneh.api.script.PollingScript;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.model.Item;
import org.osbot.script.rs2.model.NPC;
import org.osbot.script.rs2.model.RS2Object;

import java.awt.*;

/**
 * Created by Kenneth on 5/1/2014.
 */

@ScriptManifest(
        name = "Test Script",
        author = "Kenneh",
        info = "For debugging purposes",
        version = 0.1
)
public class TestScript extends PollingScript {

    @Override
    public void onPaint(Graphics graphics) {
        final Graphics2D graphics2D = (Graphics2D) graphics;
        for(NPC npc : ctx.npcs.refresh().name("Chicken")) {
            if(npc != null && npc.isVisible()) graphics2D.draw(npc.getPosition().getPolygon(ctx.script.bot));
            try {
                npc.interact("asdfasdf");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        for(RS2Object obj : ctx.objects.refresh().name("Sack")) {
            if(obj != null && obj.isVisible()) graphics2D.draw(obj.getPosition().getPolygon(ctx.script.bot));
            try {
                obj.interact("asdfasdf");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        for(Item item : ctx.inventory.refresh().name("Feather")) {
            item.interact("asdfasdf"); // Okay, there is literally no reason for this not to exist.
        }
    }

    @Override
    public void start() {

    }

    @Override
    public int poll() {
        return 50;
    }
}

I actually don't know why this doesn't exist when there's ItemDefinition. I've always found the Item class to be rather useless, lol.

Yeah, inefficient too. I hate the idea of needing to iterate twice to validate and interact, but there seems to be no other way because Item and ItemDefinition hold neither the index of the item or any methods that return the widget child the item belongs to. And that's why I like how I structured my shop api. smile.png

Edited by liverare

How to know when someone didn't read the thread wink.png

 

Hopefully this will be fixed in v2.

 

Edit;

There isn't even an interactWithItem(), the Item class is literally useless

 

f8MRkXR.png

Sorry!

 

But I wouldn't say the Item class is useless. I just think that the Item class should at least be able to store the RSInterface child, which you could then interact with.

Yeah, inefficient too. I hate the idea of needing to iterate twice to validate and interact, but there seems to be no other way because Item and ItemDefinition hold neither the index of the item or any methods that return the widget child the item belongs to. And that's why I like how I structured my shop api. smile.png

Yo! Your solution may be to use 

8uSDu.png

and

8uSEt.png

But I wouldn't say the Item class is useless. I just think that the Item class should at least be able to store the RSInterface child, which you could then interact with.

The inventory only has one Interface child.

Which has multiple grandchildren for each Item.... >.>

Incorrect, the InterfaceChild is 149, 0 and that child alone contains all the items. It's the same with equipment, store and deposit box. Bank and trade screen do have grandchildren for items though.

Edited by Rawr

[ . . .]]

Yo! Your solution may be to use 

8uSDu.png

and

8uSEt.png

 

I suppose that would be a fine substitute. But I'd still want the Item class to store the item's slot index and have interaction method.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.