Skip 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.

help with scripts

Featured Replies

ok im having a problem where when people post there scripts and its 1 line the scripts wont load, iv tested it multipul times any script on here thats 1 line wont work it has to be where its fully layed out normally because those scripts do work. is there anyway for someone with out any knowledge of scripts to be able to fix it? i mean because i dont know where to seperate the lines and theres a bunch of scripts on here that i really need to use but i cant because there in that 1 line format. 

I'm guessing on notepad, you have wrap text turned off which makes all the text go onto one line.

 

Go onto format and select wrap text so it's on. Not sure if I understood the question, can you please try rewording it?

 

Thanks.

  • Author

ill give u 3 examples

 

here is a script 

import org.osbot.script.Script;import org.osbot.script.ScriptManifest; import javax.swing.JComboBox;import javax.swing.JOptionPane;import javax.swing.JPanel;import java.awt.Color;import java.awt.Graphics; @ScriptManifest(name = "PPThief", author="PengPhin", version = 1.0D, info = "Only Supports upto Master Farmer")class PPThief extends Script { 	enum State {		INPUT, IDLE, ROBBING,	} 	Npc[] Npcs = [			new Npc("People level 1", [ 1, 2, 3, 4, 5 ] as int[]), // Add new NPCs here			new Npc("Farmer	level 10", 7 as int[]),			new Npc("Warrior Women	Level 25",  15  as int[]),			new Npc("Rogues	Level 32",  187 as int[]),			new Npc("Cave Goblins Level 36", [ 1822, 1823, 1824, 1825 ] as int[]),			new Npc("Master Farmer Level 38", [ 2234, 2235] as int[]),				] as Npc[]; 	State state = State.INPUT;	Npc Npc = null; 	void onStart() {		if (state == State.INPUT) {			showInput();		}	} 	int onLoop() {		switch(state) {			case State.ROBBING:				return steal();		}		return 1000 + gRandom(400, 800);	} 	int steal() {		def npc = closestNPC(Npc.getIds());		if (npc != null) {			if (selectEntityOption(npc, "Pickpocket")) {				return 2000 + random(200, 500);			}		}		return 1000 + random(200, 1000);	} 	void onPaint(Graphics g) {		g.setColor(new Color(0.1f, 0.1f, 0.1f, 0.7f));		g.fillRect(3, 308, 513, 30); 		g.setColor(Color.GREEN);		g.drawString("PengPhins Robber | Npc: ${Npc.getName()} | State: ${state}", 10, 327);	} 	void showInput() {		JPanel panel = new JPanel();		String[] Npcs = new String[this.Npcs.length];		for(int i = 0; i < Npcs.length; i++) {			Npcs[i] = this.Npcs[i].getName();		}		JComboBox combo = new JComboBox(Npcs);		panel.add(combo);		int ret = JOptionPane.showConfirmDialog(null, panel, "Select Npc", JOptionPane.OK_CANCEL_OPTION);		if (ret == JOptionPane.OK_OPTION) {			Npc = this.Npcs[combo.getSelectedIndex()];			state = State.ROBBING;		} else {			showInput();			//TODO: Add Banking, Food Support		}	}  	class Npc { 		private final String name;		private final int[] ids; 		public Npc(String name, int[] ids) {			this.name = name;			this.ids = ids;		} 		public String getName() {			return name;		} 		public int[] getIds() {			return ids;		}  	} }

here is the same script with that thing u told me to do

import org.osbot.script.Script;import org.osbot.script.ScriptManifest; import javax.swing.JComboBox;import javax.swing.JOptionPane;import javax.swing.JPanel;import java.awt.Color;import java.awt.Graphics; @ScriptManifest(name = 

"PPThief", author="PengPhin", version = 1.0D, info = "Only Supports upto Master Farmer")class PPThief extends Script { 	enum State {		INPUT, IDLE, ROBBING,	} 	Npc[] Npcs = [			new Npc("People level 1", [ 

1, 2, 3, 4, 5 ] as int[]), // Add new NPCs here			new Npc("Farmer	level 10", 7 as int[]),			new Npc("Warrior Women	Level 25",  15  as int[]),			new Npc("Rogues	Level 32",  187 as int[]),	

		new Npc("Cave Goblins Level 36", [ 1822, 1823, 1824, 1825 ] as int[]),			new Npc("Master Farmer Level 38", [ 2234, 2235] as int[]),				] as Npc[]; 	State state = State.INPUT;	

Npc Npc = null; 	void onStart() {		if (state == State.INPUT) {			showInput();		}	} 	int onLoop() {		switch(state) {			case State.ROBBING:			

	return steal();		}		return 1000 + gRandom(400, 800);	} 	int steal() {		def npc = closestNPC(Npc.getIds());		if (npc != null) {			if (selectEntityOption(npc, 

"Pickpocket")) {				return 2000 + random(200, 500);			}		}		return 1000 + random(200, 1000);	} 	void onPaint(Graphics g) {		g.setColor(new 

Color(0.1f, 0.1f, 0.1f, 0.7f));		g.fillRect(3, 308, 513, 30); 		g.setColor(Color.GREEN);		g.drawString("PengPhins Robber | Npc: ${Npc.getName()} | State: ${state}", 10, 327);	} 	void showInput() {	

	JPanel panel = new JPanel();		String[] Npcs = new String[this.Npcs.length];		for(int i = 0; i < Npcs.length; i++) {			Npcs[i] = this.Npcs[i].getName();		}		JComboBox 

combo = new JComboBox(Npcs);		panel.add(combo);		int ret = JOptionPane.showConfirmDialog(null, panel, "Select Npc", JOptionPane.OK_CANCEL_OPTION);		if (ret == JOptionPane.OK_OPTION) {			

Npc = this.Npcs[combo.getSelectedIndex()];			state = State.ROBBING;		} else {			showInput();			//TODO: Add Banking, Food Support		}	}  	class Npc { 	

	private final String name;		private final int[] ids; 		public Npc(String name, int[] ids) {			this.name = name;			this.ids = ids;		} 		public 

String getName() {			return name;		} 		public int[] getIds() {			return ids;		}  	} }

and here is a diffrent script that works

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)
		}
	}
	
}

the first 1 dosnt work and thats how they are posted here, the 2nd 1 is the first 1 but with word wrap and that still dosnt work but the 3rd 1 isnt word wrap and was posted like that and it does work. im asking how do i make the 1st 1 turn out like the 3rd 1

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.