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.

[New!] Store class library - Access a store easily

Featured Replies

Hello OSBot scripters,
 
Today I bring to you, a new store class library. I plan to maintain and modify this to work flawlessly. Until the OSBot team is able to add it into their API. I happen to know that there is already an library like this. However that library wasn't maintained or offered support for which I plan to do. Any feedback given will be appreciated and considered.
 
1. Setting up:
    A. You add the class files to your source and compile them with it.
    B. You import the Jar as an external library and include it with your script for usage.
 

 
 
2. Store example:

//Make a store instance
Store store = new Store(this.bot.getAPI());

//Check if store is open
if(store.isOpen()){
//Buy something
}else{
//Open the store
}

3. Item example:




//get item from the store
StoreItem item = store.getStoreItem("Bronze arrow");


//interacting with the item
if(item != null && item.getAmount>0){
    item.interact("Buy 10");
    sleep(1000);
}

 


Link:
Store.java
StoreItem.java

Releases:

Changelogs:

- Changed the return type of close to void
- Fixed buying 2nd row items.

 

@Merccy - Base concept
@bfir3 - Accurate item amount.

Edited by Neodork

StoreItem#interact(String action) is bad. 

 

Better

 

StoreItem#buy(int amount). You handle the rest.

 

I didn't check the source so this method may exist but if it doesn't make it.

 

 

I'm guessing StoreItem extends w/e the item class in OSBot is (I don't develop for this client).

 

StoreItem i = Inventory.get(id).

 

StoreItem.sell(int amount) 

Edited by Assume

  • Author

StoreItem#interact(String action) is bad. 

 

Better

 

StoreItem#buy(int amount). You handle the rest.

 

I didn't check the source so this method may exist but if it doesn't make it.

 

 

I'm guessing StoreItem extends w/e the item class in OSBot is (I don't develop for this client).

 

StoreItem i = Inventory.get(id).

 

StoreItem.sell(int amount) 

 

Actually storeItem.interact(String action); is the right way to go, because it is not necessarily used for buying, you can also select the value action for example. In this case the interact method can be used to select all options in the store. I would not understand the logic of passing an integer argument as the is no Buy X action in a store. 

I don't intend to use all fields the OSBot so I didn't extend it. Also casting from a super class to a subclass is not possible.

Thanks. This works great now.

 

Brilliant help, thanks.

I might be wrong, but cant you just use Store store = new Store(this);

 

 

Pretty sure using this will just use everything. Meaning, less typing and less confusing.

  • Author

I might be wrong, but cant you just use Store store = new Store(this);

 

 

Pretty sure using this will just use everything. Meaning, less typing and less confusing.

I could do that, but in that case I would be passing an instance of Script to the Store library. There is no need for us to use the methods inside the Script class all we need is to use the MethodProvider which is the super class of Script. But if you prefer to pass the instance of the class Script to the Store library I won't stop you. You're able to cast from sub to super class so there will be no problem in doing so.

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.