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.

Npc If Clause

Featured Replies

Trying to make a script that buys from an npc and not sure how to get the clause right. I know how to steal from a stall(below), how would i change it to get it into trading and buying from an npc?

private State getState() {

Entity stall = object.closest("Tea Stall")

if (!inventory.isEmpty())

return State.DROP;

if (stall != null)

return State.STEAL;

return State.WAIT;

}

Also how would i make it ao when the script as finished opening feather packs that it wont drop the gold stack?

What I have so far...

private State getState() {

Entity npc = object.closest("NPC NAME")

Not even sure if this is right lol.

private enum State {

TRADE, OPEN

};

Thank you

Logic is a fundamental part of programming, it really can't be taught. Just add more checks and if statements before actually returning steal or drop.

 

Pseudo code example:

 

boolean shouldTrade = false;

 

if(!shouldTrade){

      if(!inventory.isFull(){

         return State.Steal;

       } else { return State.Drop }

} else {

return State.Trade;

}

					if (p.getInterfaces().get(300).isValid() && p.getInterfaces().get(300).isVisible()) {
						// store is open
						if (p.getStore().contains(1337)) {
							if (p.getStore().buy("czar", 1)) {
								return 1000;
							}
						}
					} else {
						Entity shopkeeper = p.npcs.closest("Shopkeeper");
						if (shopkeeper != null) {
							if (shopkeeper.interact("Trade")) {
								return 1000;
							}
						}
					}

 

That's for buying something from shop,

 

As for the 'dropping gold', check if inventory is full, not if inventory isn't empty

 

!getInventory().isEmpty()        -->>> getInventory().isFull()

 

PM me if you need more help :D

Edited by Czar

Guest
This topic is now closed to further replies.

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.