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.

Check if wearing item?

Featured Replies

Hi guys, its me again. Making some progress on my first script but i ran into an issue.

I am trying to make the script check if i'm wearing a ring (to check if there are still duelling ring charges). 

This is my code but it doesn't seem to work :(

if (!equipment.isWearingItem(EquipmentSlot.RING)) {

log("no ring");

status = "Withdrawing ring of duelling";

getBank().withdraw("Ring of duelling(8)", 1);

new ConditionalSleep(10000) {

@Override

public boolean condition() throws InterruptedException {

return inventory.contains("Ring of duelling(8)");

}

}.sleep();

bank.close();

sleep(random(500,700));

inventory.getItem("Ring of duelling(8)").interact("Wear");

new ConditionalSleep(10000) {

@Override

public boolean condition() throws InterruptedException {

return getEquipment().isWearingItem(EquipmentSlot.RING);

}

}.sleep(); 



}

 

I believe the issue is in the first if statement of isWearingItem 

Edited by rallostar

Not on an IDE but probs something like 

if (!equipment.isWearingItem(EquipmentSlot.RING, duelring -> duelring.getName().contains("Ring of duelling"))){
	// no ring

Edit: Thinking about it, isn't there isWearingItemThatContains?

Edited by HeyImJamie

  • Author
15 minutes ago, HeyImJamie said:

Not on an IDE but probs something like 


if (!equipment.isWearingItem(EquipmentSlot.RING, duelring -> duelring.getName().contains("Ring of duelling"))){
	// no ring

Edit: Thinking about it, isn't there isWearingItemThatContains?

Yes that's true but can't I just check if ring is empty? Would be a smaller code too. 

I'll try it with isWearingItemThatContains tho to see if that works.

 

EDIT: It  worked and logged the No Ring string, but then it logged this error:

[ERROR][Bot #1][07/17 01:34:37 AM]: Error in script executor!
java.lang.NullPointerException
    at Main.onLoop(Main.java:190)
    at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(vj:152)
    at java.lang.Thread.run(Thread.java:745)

this error comes after sleeping for 10000 ms 

dunno where its coming from

Edited by rallostar

  • Author
1 minute ago, Abysm said:

Maybe because its "Ring of dueling" with 1 "L" and not 2?  a7d4ed1c3a.png 

Lol wtf.. I googled it but in RS3 it's duelling and osrs its dueling:facep:. Thanks mate !

5 minutes ago, rallostar said:

Lol wtf.. I googled it but in RS3 it's duelling and osrs its dueling:facep:. Thanks mate !

Even the smallest mistakes make your script fail :boge:

 

You might want to use the filter @HeyImJamie provided you so the bot can use ring of dueling no matter how much charges it has

Edited by Abysm

  • Author
5 minutes ago, Abysm said:

Even the smallest mistakes make your script fail :boge:

 

You might want to use the filter @HeyImJamie provided you so the bot can use ring of dueling no matter how much charges it has

Yes I'm using that now! Thanks @Abysm & @HeyImJamie

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.