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.

2 NPC's next to player

Featured Replies

Hi,

I have a script, which generally works. Except when this happens:

 

post-222066-0-53977200-1468968913_thumb.jpg

 

This is the code I use:

case FISHING:
	NPC fishingSpot = npcs.closest(true, 1511);
				
	camera.toTop();
	camera.moveYaw(0);
				
	if (!myPlayer().isInteracting(fishingSpot)) {
		if (fishingArea.contains(fishingSpot) && fishingArea.contains(myPlayer())) {
			log("Fishing at area 1");
			fishingSpot.interact("Harpoon");
			sleep(random(3000));
		}
		else if (fishingArea.contains(fishingSpot) && !fishingArea.contains(myPlayer())) {
			log("Area 1 is suitable, but not in reach. Walking there now");
			getWalking().walk(fishingArea);
		}
	}
	if (myPlayer().isInteracting(fishingSpot)) {
		// Do things while waiting
	}
break;

The problem is, it finds one of the spots, starts fishing, waits, then searches again, finding the other spot, and then interacting with that instead. So it is just looping, clicking at each spot every 3 seconds (the sleep timer).
 

How can I improve it?

Any help/advice is highly appreciated! smile.png

Edited by Flexeren

Hi,

I have a script, which generally works. Except when this happens:

 

attachicon.gifScript issue.jpg

 

This is the code I use:

case FISHING:
	NPC fishingSpot = npcs.closest(true, 1511);
				
	camera.toTop();
	camera.moveYaw(0);
				
	if (!myPlayer().isInteracting(fishingSpot)) {
		if (fishingArea.contains(fishingSpot) && fishingArea.contains(myPlayer())) {
			log("Fishing at area 1");
			fishingSpot.interact("Harpoon");
			sleep(random(3000));
		}
		else if (fishingArea.contains(fishingSpot) && !fishingArea.contains(myPlayer())) {
			log("Area 1 is suitable, but not in reach. Walking there now");
			getWalking().walk(fishingArea);
		}
	}
	if (myPlayer().isInteracting(fishingSpot)) {
		// Do things while waiting
	}
break;

The problem is, it finds one of the spots, starts fishing, waits, then searches again, finding the other spot, and then interacting with that instead. So it is just looping, clicking at each spot every 3 seconds (the sleep timer).

 

How can I improve it?

Any help/advice is highly appreciated! smile.png

 

use isAnimating instead? 

  • Author

I tried that earlier, but that creates another problem.
When the fishing spot disappears, the character is still "fishing" in empty water for a couple of seconds, which still counts as "isAnimating".

How do I fix that then?

Edited by Flexeren

  • Author

I may have a solution, but I need some help making it reality.


My idea:

 

First time the case is running:

- find the nearest fishing spot

- get and save the position of said fishing spot

- start fishing

 

Everytime the case is running, except first time:

- find all nearby fishing spots

- check if one of the fishing spot's positions equals the one already fishing at

 

 

I think I can figure out the rest, but that part I can't seem to figure out.

Yeah just do 

if(myPlayer.isAnimating() && fishSpot.exists(){
//We are fishing
} else {
 fishSpot.interact("Harpoon");
}

Edited by GaetanoH

 

Yeah just do 

if(myPlayer.isAnimating() && fishSpot.exists(){
//We are fishing
} else {
 fishSpot.interact("Harpoon");
}

 

^ This, but make sure fishSpot is a class member and only update it if it's null or doesn't exist

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.