Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple AutoFighter - not starting issue

Featured Replies

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

NPC npc = npcs.closest("Frog");

This needs to be moved to your attack case.

  • Author

NPC npc = npcs.closest("Frog");

This needs to be moved to your attack case.

 

Thanks for the reply. Problem is solved.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.