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.

better way to count X logs chopped?

Featured Replies

Code bellow works fine when we are not breaking, but when im breaking it fucks up and either goes up like 2+ extra logs even though we dont have that many logs.

example : we have chopped 200logs, but it returns 240 logs chopped.

		if(myPlayer() != null)
		{
		long oaksInInventory = getInventory().getAmount("Oak logs");
		if(oaksInInventory > oakpreviousInvCount){
			
			oakChopped += (oaksInInventory - oakpreviousInvCount);
			oakpreviousInvCount = oaksInInventory;
		} else if (oaksInInventory < oakpreviousInvCount){
			oakpreviousInvCount = oaksInInventory;
		}
        }

Reason im asking for some help or tips is because when we have X logs chopped i want it to do something.

Edited by atoo

12 minutes ago, atoo said:

Code bellow works fine when we are not breaking, but when im breaking it fucks up and either goes up like 2+ extra logs even though we dont have that many logs.

example : we have chopped 200logs, but it returns 240 logs chopped.


		if(myPlayer() != null)
		{
		long oaksInInventory = getInventory().getAmount("Oak logs");
		if(oaksInInventory > oakpreviousInvCount){
			
			oakChopped += (oaksInInventory - oakpreviousInvCount);
			oakpreviousInvCount = oaksInInventory;
		} else if (oaksInInventory < oakpreviousInvCount){
			oakpreviousInvCount = oaksInInventory;
		}
        }

Reason im asking for some help or tips is because when we have X logs chopped i want it to do something.

 

I believe there is a chatbox message you could listen for?

Override the onMessage method or add a message listener etc.

Or just divide XP gained by xp per log. XP gained can be obtained from the ExperienceTracker

  • Author
9 minutes ago, Explv said:

 

Or just divide XP gained by xp per log. XP gained can be obtained from the ExperienceTracker

Thanks for the tip, that seems to work git gud.

Gonna check so its flawless even if we are using breaks.

As Explv said, there are a numebr of ways. I'd probably rank (in terms of tidiness/reliability) them as follows:

  1. Message listener (easiest way is to override onMessage)
  2. Inventory listener - you'll have to implement this yourself
  3. Calculating from xp gain. Not ideal as it requires xp data which is subject to change, plus relies on being logged in and having valid xptracker data

 

  • Author
2 minutes ago, Apaec said:

As Explv said, there are a numebr of ways. I'd probably rank (in terms of tidiness/reliability) them as follows:

Calculating from xp gain. Not ideal as it requires xp data which is subject to change, plus relies on being logged in and having valid xptracker data

 

But it keeps the value of how much xp you have gained even though you log out, which is nice.

int logCount;

 @Override
    public void onMessage(Message m){
        if (m.getType().equals(Message.MessageType.GAME) && m.getMessage().toLowerCase().contains("oak logs")){
            logCount++;
        }
    }

 

  • Author
39 minutes ago, HeyImJamie said:

int logCount;

 @Override
    public void onMessage(Message m){
        if (m.getType().equals(Message.MessageType.GAME) && m.getMessage().toLowerCase().contains("oak logs")){
            logCount++;
        }
    }

 

Lit, thanks.

1 hour ago, atoo said:

But it keeps the value of how much xp you have gained even though you log out, which is nice.

Yeah, but you may find that if you start the script when logged out and stop the script before onStart currently executes, the exp-gained will be some very unpredictable (potentially massive) value as it is not initialised. Not a problem for runtime paint data, but if you start saving data this could be an issue.

  • Author
1 hour ago, Apaec said:

Yeah, but you may find that if you start the script when logged out and stop the script before onStart currently executes, the exp-gained will be some very unpredictable (potentially massive) value as it is not initialised. Not a problem for runtime paint data, but if you start saving data this could be an issue.

been botting for 2 hours and had 8 breaks.

seems to still work fine 8da8f250b4fdd413439241b14477aabf.png

25 minutes ago, atoo said:

been botting for 2 hours and had 8 breaks.

seems to still work fine 8da8f250b4fdd413439241b14477aabf.png

 

2 hours ago, Apaec said:

Yeah, but you may find that if you start the script when logged out and stop the script before onStart executes, the exp-gained will be some very unpredictable (potentially massive) value as it is not initialised. Not a problem for runtime paint data, but if you start saving data this could be an issue.

 

  • Author
5 minutes ago, Apaec said:

 

 

Oh shit didnt read properly, my bad.

But doing what u described seems something pretty stupid to do? :???:

6 minutes ago, atoo said:

Oh shit didnt read properly, my bad.

But doing what u described seems something pretty stupid to do? :???:

Yeah, but nonetheless you've got to account for it! That's what programming is about ;p

  • Author
19 minutes ago, Apaec said:

Yeah, but nonetheless you've got to account for it! That's what programming is about ;p

Well said man, well said.

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.