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.

Inventory interaction questions

Featured Replies

Hi all,

 

Which methods would you advice for the following inventory interactions:

 

- if inventory not contains Peaches && inventory contains bones -> Click on Bones to Peaches tab 

 

- if inventory not contains Peaches && inventory not contains bones -> stop script 

 

 

Thanks

Prolax

Item peaches = getInventory().getItem("Peach");

Item bones = .... Same as above

If peaches != null

Eat

Else If bones != null

Click bones to peaches

Else

Stop

Grab both item null check them. If you have peaches eat them.

If not check to see how many bones you have. If current bone > minimum. If you have tab the break it, else stop the script safely

Something like this maybe?

public class BonesToPeaches{

    private Script script;

    private static final int peachId = XXXX;
    private static final int bonesId = 526;
    private static final int bonesToPeachesTabId = 8015;

    public BonesToPeaches(Script script){
        this.script = script;
    }

    public void convertBonesToPeaches(){
        if ( hasTabRequirements() && hasTab() && !playerIsBusy() ){
            useTab();
        } else if ( !hasScriptRequirements() ) {
            script.stop();
        }
    }

    private boolean playerIsBusy(){
        return script.myPlayer().isAnimating() | script.myPlayer().isMoving();
    }

    private void useTab(){
        script.getInventory().getItem(bonesToPeachesTabId).interact()
    }

    private boolean hasTab(){
        return script.getInventory().contains(bonesToPeachesTabId);
    }

    private boolean hasTabRequirements(){
        return !script.getInventory().contains(peachId) && script.getInventory().contains(bonesId);
    }

    private boolean hasScriptRequirements(){
         return script.getInventory().contains(peachId) && script.getInventory().contains(bonesId) && hasTab();
    }

}

Edited by Explv


if(getInventory().contains("Peach")) {

if(getInventory().contains("Bones")) {

getInventory().interact("Break", "Bones to peaches");

} else {

stop(true);

}

}

Edited by FrostBug

  • Author
if(!getInventory().contains("Peach")) {
    if(getInventory().contains("Bones")) {
        getInventory().interact("Break", "Bones to peaches");
    } else {
        stop(true);
    }
}

Thanks for the replies.

 

first if statement should be not contains Peach, if I'm correct.

 

 

if(!getInventory().contains("Peach")) {    if(getInventory().contains("Bones")) {        getInventory().interact("Break", "Bones to peaches");    } else {        stop(true);    }}
Thanks for the replies.

first if statement should be not contains Peach, if I'm correct.

That statement means "if inventory does NOT contain Peach" - notice the "!"
  • Author

That statement means "if inventory does NOT contain Peach" - notice the "!"

 

Indeed, if the inventory does not contain peach, it should make bones to peaches.

if(!getInventory().contains("Peach")) {
    if(getInventory().contains("Bones")) {
        getInventory().interact("Break", "Bones to peaches");
    } else {
        stop(true);
    }
}

Thanks for the replies.

 

first if statement should be not contains Peach, if I'm correct.

 

 

You're right, mb

 

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.