system64 Posted January 5, 2015 Share Posted January 5, 2015 (edited) So i wrote a simple guild ranger script. No errors when compiling, shows up on script loader. But when I start it nothing happens. Source: import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.Area; import java.awt.*; @ScriptManifest(author = "system64", info = "range guild", name = "range Guild", version = 0, logo = "") public class range extends Script { private enum State { SHOOT_TARGET }; private State getState() { if(!myPlayer().isAnimating()) SHOOT_TARGET return State.SHOOT_TARGET; return State.SHOOT_TARGET; } public int onLoop() throws InterruptedException { switch(getState()) { case SHOOT_TARGET: interactWithJudge(); playMinigame(); break; } return random(200, 300); } private void playMinigame() throws InterruptedException { RS2Object target = getObjects().closest("Target"); if(target != null) { for(int x = 1; x >= 10; x ++) { if(target.interact("fire at target")) { sleep(100); } } } } private void interactWithJudge() throws InterruptedException { NPC judge = getNpcs().closest("Competetion Judge"); if(judge != null){ judge.interact("Talk-to"); sleep(500); } if(getInterfaces().getChild(548, 116).isVisible()) { sleep(random(600, 1000)); dialogues.clickContinue(); sleep(random(600, 1000)); dialogues.selectOption("Sure I'll give it a go"); sleep(random(600, 1000)); } } } Edited January 5, 2015 by system64 Link to comment Share on other sites More sharing options...
BotRS123 Posted January 5, 2015 Share Posted January 5, 2015 (edited) Not sure what is wrong, but have you checked any of these? Judge is null? Wrong interface? Interface is not visible? Since you said nothing is happening, my best guess is the Judge is null. Edited January 5, 2015 by BotRS123 Link to comment Share on other sites More sharing options...
Joseph Posted January 5, 2015 Share Posted January 5, 2015 i told him to debug your the script. it will help you so much Link to comment Share on other sites More sharing options...
system64 Posted January 5, 2015 Author Share Posted January 5, 2015 Not sure what is wrong, but have you checked any of these? Judge is null? Wrong interface? Interface is not visible? Since you said nothing is happening, my best guess is the Judge is null. I start the script infront of the judge Link to comment Share on other sites More sharing options...
BotRS123 Posted January 5, 2015 Share Posted January 5, 2015 I start the script infront of the judge I found the issue lol The judge is null. Just look at the code closely and see if you can figure out why it is null. I don't want to give you the answer immediately, but if you really can't figure it out, tell me. Link to comment Share on other sites More sharing options...
system64 Posted January 5, 2015 Author Share Posted January 5, 2015 I found the issue lol The judge is null. Just look at the code closely and see if you can figure out why it is null. I don't want to give you the answer immediately, but if you really can't figure it out, tell me. haha i have no idea been trying to figure it out for a while now. Link to comment Share on other sites More sharing options...
BotRS123 Posted January 5, 2015 Share Posted January 5, 2015 haha i have no idea been trying to figure it out for a while now. Here is another hint. Look at this line and look in game at the NPC. NPC judge = getNpcs().closest("Competetion Judge"); Link to comment Share on other sites More sharing options...
system64 Posted January 5, 2015 Author Share Posted January 5, 2015 (edited) Here is another hint. Look at this line and look in game at the NPC. NPC judge = getNpcs().closest("Competetion Judge"); WOOOO it works!! thanks man Edited January 5, 2015 by system64 Link to comment Share on other sites More sharing options...
BotRS123 Posted January 5, 2015 Share Posted January 5, 2015 WOOOO it works!! thanks man I'm glad you figured it out from the hint. Link to comment Share on other sites More sharing options...
system64 Posted January 5, 2015 Author Share Posted January 5, 2015 Alright, it successfully has the conversation with the competition judge. But doesn't seem to attack the target. Link to comment Share on other sites More sharing options...