Vilius Posted September 15, 2015 Posted September 15, 2015 (edited) Fixed Edited September 15, 2015 by Viliuks
Precise Posted September 15, 2015 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
Chris Posted September 15, 2015 Posted September 15, 2015 (edited) script.log(salmon.isVisible()); Edited September 15, 2015 by Sinatra
Vilius Posted September 15, 2015 Author 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.
Joseph Posted September 15, 2015 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
Vilius Posted September 15, 2015 Author Posted September 15, 2015 Nevermind, canProcess is returning false. ;_;