Prolax Posted June 21, 2016 Posted June 21, 2016 import org.osbot.rs07.script.Script; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Prolax", info = "Prolax Auto Fighter", name = "Prolax Auto Fighter", version = 1, logo = "") public class main extends Script { String logState; NPC npc = npcs.closest("Frog"); @Override public void onStart() { log("Let's get started!"); } private enum State { ATTACK, IDLE }; private State getState() { if (npc != null && !myPlayer().isMoving() && !combat.isFighting() && npc.isAttackable()) { return State.ATTACK; } return State.IDLE; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case ATTACK: logState = "Attacking " + npc; npc.interact("Attack"); break; case IDLE: break; } return random(800, 1200); } @Override public void onExit() { log("Thanks for running Prolax Auto Fighter"); } @Override public void onPaint(Graphics2D g) { g.drawString("Status: " + logState, 8, 303); } } Hi, I have made this really basic code to auto fight frogs. When I start the script nothing happens, not even shows the onStart() log in the logger? Probably missing something. Thanks, Prolax
Vilius Posted June 21, 2016 Posted June 21, 2016 NPC npc = npcs.closest("Frog"); This needs to be moved to your attack case.
Prolax Posted June 21, 2016 Author Posted June 21, 2016 NPC npc = npcs.closest("Frog"); This needs to be moved to your attack case. Thanks for the reply. Problem is solved. 1