tivo444 Posted March 28, 2016 Share Posted March 28, 2016 (edited) Hello This is probably just a dumb error on my part, but for some reason, this NPC object isn't working correctly. Here's my code: package nodes; import core.Node; import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; /** * Created by ___ on 3/28/2016. */ public class Finding extends Node { NPC npc; NPC previous_npc; public Finding(Script script) { super(script); } public String status() { return "Finding new NPC to chat with..."; } /** * This method checks to make sure the conditions are true, if they are, it will start * the Finding node. (Located in the execute() method. * @return if the conditions are met or not. * @throws InterruptedException */ public boolean validate() throws InterruptedException { if (!script.getDialogues().inDialogue()) return true; return false; } public boolean execute() throws InterruptedException { npc = npcs.closest(new Filter<NPC>() { @Override public boolean match(NPC npc){ return npc != previous_npc && npc.hasAction("Talk-to"); } }); if(npc != null){ npc.interact("Talk-to"); } return true; } } I get an error on this line: npc = npcs.closest(new Filter<NPC>() { With "npcs" saying: Cannot resolve symbol: 'npcs'. I'm not sure why it isn't working, it has worked for me all other times. Any help would be appreciated. Thanks. Edited March 28, 2016 by tivo444 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted March 28, 2016 Share Posted March 28, 2016 (edited) script.getNpcs().closest(..) Edited March 28, 2016 by FrostBug 1 Quote Link to comment Share on other sites More sharing options...
tivo444 Posted March 28, 2016 Author Share Posted March 28, 2016 script.getNpcs().closest(..) Wow. Thanks! I can't believe I missed that. Quote Link to comment Share on other sites More sharing options...
Acerd Posted March 28, 2016 Share Posted March 28, 2016 Also you're better off having your execute() as a void as having as a boolean doesnt make too much sense. (at least i think that way and its better)also in your validate() instead of doing if statements you could do this: public boolean validate() throws InterruptedException { return !script.getDialogues().inDialogue(); } or even public boolean validate() throws InterruptedException { return condition1 && condition2 || condition3; } Quote Link to comment Share on other sites More sharing options...
Saiyan Posted March 28, 2016 Share Posted March 28, 2016 Also you're better off having your execute() as a void as having as a boolean doesnt make too much sense. (at least i think that way and its better) also in your validate() instead of doing if statements you could do this: public boolean validate() throws InterruptedException { return !script.getDialogues().inDialogue(); } or even public boolean validate() throws InterruptedException { return condition1 && condition2 || condition3; } S2??? GIVE THIS MAN S3 OR RIOT! Quote Link to comment Share on other sites More sharing options...