trainux Posted May 9, 2018 Posted May 9, 2018 attempt to interact in the following way: RS2Object fish_pot = getObjects().closest("Fishing spot"); fish_pot.interact("Small Net"); and I get the following error: [ERROR][Bot #1][05/09 02:23:35 PM]: Error in script executor! java.lang.NullPointerException at Scripts.Bot.onLoop(Bot.java:479) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ph:114) at java.lang.Thread.run(Unknown Source)
Night Posted May 9, 2018 Posted May 9, 2018 getObjects().getClosest() can return a null object, I'd recommend trying some Java tutorials to learn about NPEs.
Hannes7337 Posted May 9, 2018 Posted May 9, 2018 (edited) Hey man, try this: if(fish_spot != null){ fish_spot.interact("Small Net"); } Btw: I think fish spots are npcs instead of rs2objects , but i'm not sure Edited May 9, 2018 by Hannes7337
01053 Posted May 10, 2018 Posted May 10, 2018 5 hours ago, trainux said: oh! interesting are NPC. Thank you all. Yes, and make sure you do your null check. final NPC fishingSpot = script.getNpcs().closest("Fishing spot"); if (fishingSpot != null) fishingSpot.interact("Small net");