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.

How can i accurately gage "Items collected"?

Featured Replies

When picking this item up, there's no game message. So therefor, i can't use onMessage. (I feel this is the most reliable way of adding info to paint.)

 

When i pick the item up, the script sometimes miss clicks and adds +1 to int "looted" anyways. 

 

					supersecretitem.interact("Take");
					looted++;

This is what i have now. 

So my question to you is: What is a way that i can accurately detect when this item is picked up?

 

I thought about getting the current count in the inventory then when it enters the inventory it looted++'s but i couldn't figure it out.

Any help is appreciate. Looking to learn.

get inventory count before and compare to after, if it is greater,  looted ++ or (difference between inventory count before and after).

get inventory count before and compare to after, if it is greater,  looted ++ or (difference between inventory count before and after).

 

Like i said, i tried this method. I ended up with like 5 ints and super confused. 

An example, if you have one, would be appreciated.

this may work though i have not tested but it is something to work with.

long loot = 0;
long before = client.getInventory().getAmount("ITEM_NAME");
loot.interact("LOOT");
long after = client.getInventory().getAmount("ITEM_NAME");
		
		if(after > before) {
			loot += (after-before);
		}

Edited by precise

Something like this would work I think

long amount = client.getInventory().getAmount("Item");
        item.interact("Take");
        sleep(500);
        while(myPlayer().isMoving()){
            sleep(50);
        }
        sleep(500);
        if(amount != client.getInventory().getAmount("Item")){
            itemsLooted++;
        }

Yeah basically the same as above...

Edited by Ande

I've actually got a pretty cool custom class for handling loot tracking + Zybez price integration if u want it. :3

public ItemWatcher watcher = null;
public Thread wt = null;

public void onStart() {
  this.watcher = new ItemWatcher(this);
  this.wt = new Thread(this.watcher);
  this.wt.start();
}
public int onLoop() {
  System.out.println(this.watcher.getCollected());
  return 600;
}

public void onExit() {
  this.watcher.kill();
}
ItemWatcher.java

public class ItemWatcher implements Runnable {
  private Script s;
  private int start_item = 0;
  private int item_now = 0;
  private int collected_items = 0;
  private int item = 1337;

  private boolean run = true;
  public ItemWatcher(Script s) {
    this.s = s;
    this.start_item = s.client.getInventory().getAmount(item);
  }
  public void run() {
    while (run) {
      this.items_now = s.client.getInventory().getAmount(item);
      if (items_now > start_item) {
        this.collected_items += (items_now - start_item);
        this.start_item = items_now;
      }
      Thread.sleep(600);
    }
  }
  public void kill() {
    this.run = false;
  }
  public int getCollected() {
    return collected_items;
  }
}
ignore any typos, it was done in the osbot reply

Edited by dreamliner

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.