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.

Broken code?

Featured Replies

Please can someone explain why this works 

NPC goblin = getNpcs().closest("Goblin");

goblin.interact("Attack");

while(goblin.exists() == true) {

 

but this doesn't:

NPC spot = getNpcs().closest("Fishing spot");

spot.interact("Net");
while(spot.exists() == true) {

 

(I also tried with isVisable())

 

I can't figure out how to figure out the player animation id so i am checking to see if the spot exists before fishing again, thing is it never leaves the loop

 

 

Edited by osrs_pvm

h0ly im autistic

Edited by phony

  • Author
2 minutes ago, phony said:

Fishing spot isn't an NPC

But I can still fish and interact with it? code works to the loop, but never leaves

 

edit: maybe I am thinking of it wrong; I think of npc as any alive object, anything that is dynamic(which include fishing spots) and RS2Objects as stationary objects likes trees/doors/ect

Edited by osrs_pvm

4 minutes ago, osrs_pvm said:

Please can someone explain why this works 

NPC goblin = getNpcs().closest("Goblin");

goblin.interact("Attack");

while(goblin.exists() == true) {

 

but this doesn't:

NPC spot = getNpcs().closest("Fishing spot");

spot.interact("Net");
while(spot.exists() == true) {

 

(I also tried with isVisable())

 

I can't figure out how to figure out the player animation id so i am checking to see if the spot exists before fishing again, thing is it never leaves the loop

 

 

you dont need the == true in your checks

 

settings - options - my player debug

1 minute ago, phony said:

Fishing spot isn't an NPC

yes it is

Uhmm why do you not Null check.

if !myplayer.isanimating -> if spot != null -> interact with spot -> sleep until we're animating

3 minutes ago, phony said:

Fishing spot isn't an NPC

:???:

  • Author
1 minute ago, HeyImJamie said:

Uhmm why do you not Null check.

if !myplayer.isanimating -> if spot != null -> interact with spot -> sleep until we're animating

:???:

Because i still can't figure out how to create a myplayer object :) and I will do the null later dw

3 minutes ago, Deceiver said:

you dont need the == true in your checks

 

settings - options - my player debug

yes it is

Ah, I will try without the ==; and I have been using the debug(it is a life saver)

There is no reason to use a while loop to continue to fish. The method onLoop() gets called over and over until the script is exited, so you can just have an if statement to check when to fish

  • Author
3 minutes ago, TheWind said:

There is no reason to use a while loop to continue to fish. The method onLoop() gets called over and over until the script is exited, so you can just have an if statement to check when to fish

when it creates an object and fishes, it is in the onLoop(); the is.visable is there to check to make sure it is fishing still, and if it is, keep checking my inv and bank if i need too, if the spot doesnt exist/!exist()/!isVisable() to leave the checking loop; relabel a new object; fish again; go into checker

  • Author

Also removing == did not change anything(didn't think it would, thanks for simplifying tho)

  • Author

Figured it out, I thought you had to create a player object for your player; i just called myPlayer() and checked to see if it was animating. This way works just fine, thanks

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.