Botre Posted April 22, 2015 Share Posted April 22, 2015 Replace your getState() method with this private State getState() { Entity FS = npcs.closest("Fishing spot"); if (!inventory.isEmptyExcept("Small fishing net")) return State.DROP; if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving()) return State.FISH; return State.WAIT; } fixed private State getState() { if (!inventory.isEmptyExcept("Small fishing net")) return State.DROP; else { Entity FS = npcs.closest("Fishing spot"); if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving()) { return State.FISH; } return State.WAIT; } Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted April 22, 2015 Share Posted April 22, 2015 Replace your getState() method with this private State getState() { Entity FS = npcs.closest("Fishing spot"); if (!inventory.isEmptyExcept("Small fishing net")) return State.DROP; if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving()) return State.FISH; return State.WAIT; } fixed private State getState() { if (!inventory.isEmptyExcept("Small fishing net")) return State.DROP; else { Entity FS = npcs.closest("Fishing spot"); if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving()) { return State.FISH; } return State.WAIT; } Thanks both, got it working! Quote Link to comment Share on other sites More sharing options...
Epsilon Posted April 23, 2015 Share Posted April 23, 2015 This looks really good, I'm hopefully going to learn some scripting stuff once I finish my exams and this will definitely be where I start! Quote Link to comment Share on other sites More sharing options...
ChainGay Posted April 29, 2015 Share Posted April 29, 2015 Thanks a ton for this!! Quote Link to comment Share on other sites More sharing options...
Aart1 Posted May 6, 2015 Share Posted May 6, 2015 (edited) Followed your guide and i really enjoyed it, i tried to make a simple lesser demon killer but i received a couple errors in eclipse as well as in OSbot (obviously) Errors in eclipse were: state cannot be resolved to a type Errors in OSbot were: unknown source, wait and attack cannot be resolved to a variable My script import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "You", info = "My first script", name = "aLesserDemonKiller", version = 0, logo = "") public class main extends Script { @Override public void onStart() { log("Let's kill some demons!"); } private enum state { ATTACK, WAIT }; private State getState() { NPC demon = npcs.closest("Lesser demon"); if (demon != null) return State.ATTACK; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getstate()) { case ATTACK: NPC demon = npcs.closest("Lesser demon"); if (demon !=null) { demon.interact("Attack"); } break; case wait: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit() { log("Thank you for running my script!"); } @Override public void onPaint(Graphics2D g) { } } Edited May 6, 2015 by Aart1 Quote Link to comment Share on other sites More sharing options...
Twin Posted May 6, 2015 Share Posted May 6, 2015 Followed your guide and i really enjoyed it, i tried to make a simple lesser demon killer but i received a couple errors in eclipse as well as in OSbot (obviously) Errors in eclipse were: state cannot be resolved to a type Errors in OSbot were: unknown source, wait and attack cannot be resolved to a variable My script import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "You", info = "My first script", name = "aLesserDemonKiller", version = 0, logo = "") public class main extends Script { @Override public void onStart() { log("Let's kill some demons!"); } private enum state { ATTACK, WAIT }; private State getState() { NPC demon = npcs.closest("Lesser demon"); if (demon != null) return State.ATTACK; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getstate()) { case ATTACK: NPC demon = npcs.closest("Lesser demon"); if (demon !=null) { demon.interact("Attack"); } break; case wait: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit() { log("Thank you for running my script!"); } @Override public void onPaint(Graphics2D g) { } } Make it public enum State and not state. Quote Link to comment Share on other sites More sharing options...
change your name Posted May 9, 2015 Share Posted May 9, 2015 I followed the instructions in the OP and went to test the tea stealer but it is not showing up in my list of scripts in OSbot. Did I do something wrong? Quote Link to comment Share on other sites More sharing options...
dwreck8 Posted May 10, 2015 Share Posted May 10, 2015 Apaec, would you be able to help me? For whatever reason I can't run eclipse, it says it downloads but then I can't find the file etc... Quote Link to comment Share on other sites More sharing options...
CTek Posted May 14, 2015 Share Posted May 14, 2015 I followed the instructions in the OP and went to test the tea stealer but it is not showing up in my list of scripts in OSbot. Did I do something wrong? Where did you put the compiled script? Quote Link to comment Share on other sites More sharing options...
change your name Posted May 14, 2015 Share Posted May 14, 2015 Where did you put the compiled script? osbot/scripts Quote Link to comment Share on other sites More sharing options...
CTek Posted May 14, 2015 Share Posted May 14, 2015 osbot/scripts The script could be broken. Try refreshing your local scripts in the OSBot client if it's just not showing up. Otherwise, check your script for errors and recompile. Quote Link to comment Share on other sites More sharing options...
IsdoTEMP Posted May 16, 2015 Share Posted May 16, 2015 ill probably try this... maybe Quote Link to comment Share on other sites More sharing options...
FrEEzEKoN Posted May 16, 2015 Share Posted May 16, 2015 Greatly appreciated man was going to post about the basics have minimum script coding knowledge from school. Very informing post! Quote Link to comment Share on other sites More sharing options...
Swhit Posted May 21, 2015 Share Posted May 21, 2015 Followed your guide and i really enjoyed it, i tried to make a simple lesser demon killer but i received a couple errors in eclipse as well as in OSbot (obviously) Errors in eclipse were: state cannot be resolved to a type Errors in OSbot were: unknown source, wait and attack cannot be resolved to a variable ... case wait: sleep(random(500, 700)); break; Another thing I noticed is that in your switch block, "wait" should be "WAIT". Your private enum has entries ATTACK and WAIT, and Java is case-sensitive. Case "wait" will never trigger as is. Quote Link to comment Share on other sites More sharing options...
hybride4life Posted May 27, 2015 Share Posted May 27, 2015 (edited) When i try to open Eclipse.exe i get an error: Java was started but returned to exit code=13, Installed the newest version of Java and still get the same error. Any help? -Fixed! Edited May 27, 2015 by hybride4life Quote Link to comment Share on other sites More sharing options...