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.

inventory and client.getToolTip

Featured Replies

inventory doesn't update right away, eg, if an item leaves the inventory, inventory.contains() will still return true for a while

 

client.getToolTip() will return the last tool tip if there isn't a current one instead of returning null.

  • Author

You're missing a lot of information, please take a look here:

http://osbot.org/forum/topic/67016-read-before-posting-posting-rules-updated-march-15-2015/

 

I'm going to use your code to replicate the issue on my end for further analysis.

This is taken from my MTA script. I want it to eat bananas or peaches when the health is less than 16 until the HP is 4 less than maximum. After the first peach or banana is eaten from the first slot, inventory.getSlot("Banana","Peach") still returns the slot that first banana/peach was in. The same thing happens if I use inventory.interact()

import java.awt.Graphics2D;

import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Diclonius", info = "", logo = "", name = "Test script", version = 0)
public class test extends Script {
	
	public void onPaint(Graphics2D g) {
		g.drawString("Tool tip = \"" + client.getTooltip() + "\"", 10, 100);
	}

	
	@Override
	public int onLoop() throws InterruptedException {
		tabs.open(Tab.INVENTORY);
		log("done opening invent");
		if(skills.getDynamic(Skill.HITPOINTS) < 16)
		while(skills.getDynamic(Skill.HITPOINTS) < skills.getStatic(Skill.HITPOINTS) - 4 && 
				(inventory.contains("Banana") || inventory.contains("Peach")))  {
			int slot = inventory.getSlot("Banana","Peach");
			log("got slot " + slot);
			Item itemInSlot = inventory.getItemInSlot(slot);
			if(client.getTooltip().contains("Eat") && itemInSlot != null) {
				log("Item in slot " + slot + " = " + itemInSlot.getName());
				mouse.click(false);
				MethodProvider.sleep(random(200, 230));
			} else {
				log("Hovering slot " + slot);
				inventory.hover(slot);
			}
		}
		return 1000;
	}

}

Edited by Diclonius

im not using mirror mode. Im on the 2.3.90 and for some reason im getting isItemSelected() returning false

  • Author

We're looking at it.

I think the inventory thing was just me being an idiot, but the client.getToolTip is a bug tongue.png.

import java.awt.Graphics2D;

import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Diclonius", info = "", logo = "", name = "Test script", version = 0)
public class test extends Script {
	
	public void onPaint(Graphics2D g) {
		g.drawString("Tool tip = \"" + client.getTooltip() + "\"", 10, 100);
	}

	
	@Override
	public int onLoop() throws InterruptedException {
		return 1000;
	}

}

Edited by Diclonius

  • Author

Try the new Menu method getTooltip() from 2.3.92.

Thanks, I took a look and it seems to return the first menu option which in the case of there being no tool-tip is "Cancel" since that's the only right click option. This is just as good smile.png.

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.