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.

Detecting if another player has 'stolen' your ore from rock

Featured Replies

Hello

 

So im writing a mining script and I need a way to work out if someone else has beaten me to the ore that I have also been mining. 

 

My script can recognise when new ore appears (and my character is not mining), but i would like my script to detect when my player has not gotten the ore, so that i can mine another rock (ie, I dont want to wait for my character animation to stop before triggering the next event in my script).

 

What i currently have - "if player is idle and rock is minable -> mine".

Entity clayRock1 = objects.closest(ID_CLAY1);

if(clayRock1 != null && !myPlayer().isAnimating()){
    clayRock1.interact("Mine");
    sleep(random(2000, 2200));
}

What i need - "if player was unsuccessful in attaining ore -> [do this]".

ie "if rock has turned empty and player is still mining ore (that no longer exists - hence is a waste of time) -> [do this]".

 

 

I've tried a few methods, but nothing works. 

Any help is much appreciated,

 

Cheers!

Hello

 

So im writing a mining script and I need a way to work out if someone else has beaten me to the ore that I have also been mining. 

 

My script can recognise when new ore appears (and my character is not mining), but i would like my script to detect when my player has not gotten the ore, so that i can mine another rock (ie, I dont want to wait for my character animation to stop before triggering the next event in my script).

 

What i currently have - "if player is idle and rock is minable -> mine".

Entity clayRock1 = objects.closest(ID_CLAY1);

if(clayRock1 != null && !myPlayer().isAnimating()){
    clayRock1.interact("Mine");
    sleep(random(2000, 2200));
}

What i need - "if player was unsuccessful in attaining ore -> [do this]".

ie "if rock has turned empty and player is still mining ore (that no longer exists - hence is a waste of time) -> [do this]".

 

 

I've tried a few methods, but nothing works. 

Any help is much appreciated,

 

Cheers!

 

Method 1) The rock will have a different ID when there is no ore

Method 2) If the rock no longer has the "Mine" action, when there is no ore (i cant remember if it does or not) then you could check that

Edited by Explv

  • Author

Method 1) The rock will have a different ID when there is no ore

Method 2) If the rock no longer has the "Mine" action, when there is no ore (i cant remember if it does or not) then you could check that

 

 

Can you please give me an example of Method 1? I've tried this but i cant get it to work.

 

Method 2 will not work because the mine option is always available. 

 

Cheers

Can you please give me an example of Method 1? I've tried this but i cant get it to work.

 

Method 2 will not work because the mine option is always available. 

 

Cheers

 

 

Entity clayRock1 = objects.closest(ID_CLAY1);

if(clayRock1 != null && !myPlayer().isAnimating()){
    clayRock1.interact("Mine");
    sleep(random(2000, 2200));
} else if(clayRock1 == null){  
    // Do something else
}
  • Author

My bad. Cheers Explv!

 

Working code:

if(clayRock1 != null){
        if(!myPlayer().isAnimating()){
    		clayRock1.interact("Mine");
    		sleep(random(2000, 2200));
        }else if(missed == true){
        	clayRock1.interact("Mine");
        	missed = false;
    		sleep(random(2000, 2200));
        }
    		}else if(clayRock1 == null){
    				log("empty");
    				if(myPlayer().isAnimating()){
    					missed = true;
    				}
    			}

 

My bad. Cheers Explv!

 

Working code:

if(clayRock1 != null){
        if(!myPlayer().isAnimating()){
    		clayRock1.interact("Mine");
    		sleep(random(2000, 2200));
        }else if(missed == true){
        	clayRock1.interact("Mine");
        	missed = false;
    		sleep(random(2000, 2200));
        }
    		}else if(clayRock1 == null){
    				log("empty");
    				if(myPlayer().isAnimating()){
    					missed = true;
    				}
    			}

 

Couldn't that be simplified to:

boolean isMining = false;

if(clayRock1 != null && (!myPlayer().isAnimating() || !isMining)){
    clayRock1.interact("Mine");
    isMining = true;
    sleep(random(2000, 2200));
} else if (clayRock1 == null){
    isMining = false;
}

So that when isMining == false it ignores the fact that the player is animating, and tries to mine anyway?

 

 

 

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.