Jump to content

Simple AutoFighter - not starting issue


Prolax

Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...