July 7, 20178 yr 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 July 7, 20178 yr by osrs_pvm
July 7, 20178 yr 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 July 7, 20178 yr by osrs_pvm
July 7, 20178 yr 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
July 7, 20178 yr 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
July 7, 20178 yr 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)
July 7, 20178 yr 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
July 7, 20178 yr 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
July 7, 20178 yr Author Also removing == did not change anything(didn't think it would, thanks for simplifying tho)
July 7, 20178 yr 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