Vilius Posted September 15, 2015 Share Posted September 15, 2015 (edited) Fixed Edited September 15, 2015 by Viliuks Quote Link to comment Share on other sites More sharing options...
Precise Posted September 15, 2015 Share Posted September 15, 2015 public void process(main script) { GroundItem salmon = script.getGroundItems().closest("Raw salmon"); script.log(salmon.isVisible()); if(salmon != null && salmon.isVisible()) { salmon.interact("Take"); } else { GroundItem trout = script.getGroundItems().closest("Raw trout"); script.log(trout.isVisible()); if(trout != null && trout.isVisible()) { trout.interact("Take"); } } } }, What am I doing wrong? you're logging if it is visible before you null check it. you must null check before using it at all Quote Link to comment Share on other sites More sharing options...
Chris Posted September 15, 2015 Share Posted September 15, 2015 (edited) script.log(salmon.isVisible()); Edited September 15, 2015 by Sinatra Quote Link to comment Share on other sites More sharing options...
Vilius Posted September 15, 2015 Author Share Posted September 15, 2015 you're logging if it is visible before you null check it. you must null check before using it at all tried that, didn't work tho. Quote Link to comment Share on other sites More sharing options...
Joseph Posted September 15, 2015 Share Posted September 15, 2015 you're logging if it is visible before you null check it. you must null check before using it at all Quote Link to comment Share on other sites More sharing options...
Vilius Posted September 15, 2015 Author Share Posted September 15, 2015 Nevermind, canProcess is returning false. ;_; Quote Link to comment Share on other sites More sharing options...