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.

IronPowerminer

Featured Replies

ironoredetailfw.png

 

 

IronPowerminer

 

Mines Iron ore and drops it on the ground.

 

Changelog

V1.2 - Added Smoking rock random support and picking up pickheads
V1.1 - Added more ID's and improved the speed
V1.0 - Release

Script:

 
import java.awt.*

import org.osbot.script.Script
import org.osbot.script.ScriptManifest
import org.osbot.script.mouse.*
import org.osbot.script.rs2.*
import org.osbot.script.rs2.map.Position
import org.osbot.script.rs2.model.GroundItem
import org.osbot.script.rs2.model.Item
import org.osbot.script.rs2.model.PrimaryObject
import org.osbot.script.rs2.model.RS2Object
import org.osbot.script.rs2.ui.*

 
@ScriptManifest(name = "IronPowerminer", author="Xerion", version = 1.3D, info = "IronPowerminer")
class IronPowerminer extends Script {
 
	enum State {
		START, IDLE, MINING, DROP, BANK, BANKING
	}
 
	private final Color color1 = new Color(0.1f, 0.1f, 0.1f, 0.7f);
	private final Color color2 = new Color(255, 0, 0);

	private final Font font1 = new Font("Calisto MT", 0, 16);
	private final Font font2 = new Font("Calisto MT", 0, 11);
	
	int[] pickhandle = [480,482,484,486,488,490];
	int[] iron = [ 11955, 11956, 11954,2092,2093,5773,5774,5775,6943,6944,9717,9718,9719,14856,14857,14858,14913,14914,19000,19001,19002,21281,21282,21283,29222,29223,29221,32441,32442,32443,32451,32452,37307,37308,37309];
	int[] items = [480,482,484,486,488,490,1265 , 1267, 1269, 1271,1273,1275,1617,1619,1621,1623]
	def timeout = null;
	def starttime = null;
	def Newantiban = null;
	def MinedOre = 0;
	boolean Antibans = true
	State state = State.START;
	PrimaryObject currentRock = null;
	
	
	@Override
	void onStart() {
		starttime = System.currentTimeMillis();
		Newantiban = System.currentTimeMillis() + random(10000, 20000);
		
		def th = Thread.start {
			antiban()
		}
		
		if (client.getInventory().isFull()){
			state = State.DROP;
		}
		else { state = State.IDLE; }
	}
 
	@Override
	int onLoop() {
		if (!randoms()){
			switch(state) {
				case State.IDLE:
					return mine();
				case State.MINING:
					return check();
				case State.DROP:
					return drop();
			}
		}
		return 1000 + gRandom(400, 800);
	}
 
	int mine() {
		currentRock = closestObject(iron);
		if (currentRock != null) {
			if (selectEntityOption(currentRock,false,"Mine")) {
				timeout = Calendar.instance.timeInMillis / 1000
				state = State.MINING;
			}
		}
		return 100;
	}
	
	int check(){
	if (!currentRock.exists() || timeout + 15 < Calendar.instance.timeInMillis / 1000){
		if (!client.getInventory().isFull()){
			state = State.IDLE;
			return 500 + random(100, 1000)
		}
		else {
			if (currentTab() != Tab.INVENTORY){
				openTab(Tab.INVENTORY);
			}
			else{state = State.DROP;
			return 500 + random(100, 1000)}
		}
	}
		return 100
	}

	boolean randoms(){
		//Losing Pickhandle
		if (closestGroundItem(pickhandle) != null){
			selectEntityOption(closestGroundItem(pickhandle),"Take")
			return true
		}
		return false
	}
	
	int drop(){
		
		if (client.getInventory().contains(440)){
		selectInventoryOption(client.getInventory().getSlotForId(440),"drop");
		return random(200,450)
		} else {
		state = State.IDLE;
		}
		
		return 1000 + random(500,800)
		
	}
	
	void onMessage(String message){
		if ("You manage to mine some iron." == message){
			MinedOre++
		}
		else if (message == "This rock contains iron." || message == "There is no ore currently available in this rock."){
			state = State.IDLE;
		}
	}
	
	@Override
	void onExit(){
		Antibans = false
	}
	
	@Override
	void onPaint(Graphics g) {
		g.setColor(color1);
		g.fillRect(1, 51, 209, 94);
		g.setFont(font1);
		g.setColor(color2);
		g.drawString("IronPowerminer", 7, 76);
		g.setFont(font2);
		g.drawString("Time: " + format(System.currentTimeMillis() - starttime), 7, 130);
		g.drawString("Ore: Iron(${MinedOre})", 7, 100);
		g.drawString("State: ${state}", 7, 115);
	}
		

 
	
	String format(final long time) {
		final StringBuilder t = new StringBuilder();
		final long total_secs = time / 1000;
		final long total_mins = total_secs / 60;
		final long total_hrs = total_mins / 60;
		final int secs = (int) total_secs % 60;
		final int mins = (int) total_mins % 60;
		final int hrs = (int) total_hrs % 24;
		if (hrs < 10) {
			t.append("0");
		}
		t.append(hrs);
		t.append(":");
		if (mins < 10) {
			t.append("0");
		}
		t.append(mins);
		t.append(":");
		if (secs < 10) {
			t.append("0");
		}
		if (secs < 0){
			t.append("0")
		}
		else{
		t.append(secs);
		}
		return t.toString();
	}
	
	void antiban(){
		while(Antibans){
			if (state == State.MINING && Newantiban < System.currentTimeMillis()){
			
				int Anti = random(0 , 3)
				switch(Anti){
					case 0:
						log("Antiban: Move mouse")
						moveMouseOutsideScreen()
						Newantiban = System.currentTimeMillis() + random(40000, 120000)
					break;
					case 1:
						log("Antiban: Move camera")
						client.moveCameraToEntity(currentRock)
						Newantiban = System.currentTimeMillis() + random(40000, 120000)
					break;
					case 2:
						log("Antiban: Open Skills tab")
						if (currentTab() != Tab.SKILLS){
							openTab(Tab.SKILLS);
						}
						Newantiban = System.currentTimeMillis() + random(40000, 120000)
					break;
					case 3:
						log("Antiban: Open Friends tab")
						if (currentTab() != Tab.FRIENDS){
							openTab(Tab.FRIENDS);
						}
						Newantiban = System.currentTimeMillis() + random(40000, 120000)
					break;
				}
			}
		Thread.sleep(1000)
		}
	}
	
}

 

Edited by Xerion

Awesome! Added this script :)

Looks great there's a lot of things needed to be done.

 

 

Just a few suggestions you can take into consideration.

 

  • Random Event (Completes random events)
  • Option to bank (I know this is a power miner, but people would still want to keep their ores.)

Edited by Peter

Xerion, could you please send me then new script code when done?
Also, could you add banking support for Yanille? <3

 

Running the script at the moment - Here's some information on how it can be improved :)

1: Make it click the rocks faster.
2: Stop the camera a bit, it moves way to much.
 

Will add more if needed.

Edited by Nightmare

where should we use this bot cuz its not working for me its stuck in IDE

Just starts on idle, doesnt do anything :( ? is it only meant to work in a certain spot?

thanks

Save as IronPowerminer.groovy and in the OSBotscripts folder.

i did that i have the script running like the GUI comes up but it just sits in IDLE

  • Author

i did that i have the script running like the GUI comes up but it just sits in IDLE

What location are you using?

One near Ardougne, 3 iron ore rocks. Which rock did u script this in?

using same place

Guest
This topic is now closed to further replies.

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.