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;
}
}