April 22, 201510 yr 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; }
April 22, 201510 yr 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!
April 23, 201510 yr 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!
May 6, 201510 yr 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, 201510 yr by Aart1
May 6, 201510 yr 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.
May 9, 201510 yr 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?
May 10, 201510 yr 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...
May 14, 201510 yr 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?
May 14, 201510 yr 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.
May 16, 201510 yr Greatly appreciated man was going to post about the basics have minimum script coding knowledge from school. Very informing post!
May 21, 201510 yr 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.
May 27, 201510 yr 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, 201510 yr by hybride4life
Create an account or sign in to comment