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.

bot state skeleton script

Featured Replies

	import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
	
	
	@ScriptManifest(name = "", author = "", version = 1D, info="")
	public class test extends Script {
		
		enum State {
			FIRST, SECOND, THIRD;
		}
	
		private State state;
			
		public void onStart(){
		if(client.getInventory().isFull()){
				state = State.FIRST;
		}
		}
		
		public int onLoop() throws InterruptedException{
			switch (state){
			case FIRST:
				return first();
			case SECOND:
				return second();
			case THIRD:
				return third();
			}
		return random(10, 20);
		}
	
		int first() throws InterruptedException {
			return 0;
		}
	
		int second() throws InterruptedException{
			// TODO Auto-generated method stub
			return 0;
		}
	
		int third() throws InterruptedException{
			// TODO Auto-generated method stub
			return 0;
		}
	
	}

----------> "state = State.FIRST;" <-------------------

 

using this will help you switch between your botstates

 

Edited by josedpay

  • 4 weeks later...
  • Author

could u give a example? smile.png

Sure.

 

edit:

remove the oce i had here. Tooo many errors.

 

edit 2:

add new code with out error. at the post below

Edited by josedpay

Thanks for us learners when people comment scripts like this // blah blah . Makes a ton easier to read and work out

  • Author

Thanks for us learners when people comment scripts like this // blah blah . Makes a ton easier to read and work out

 i dont even know if your joking around or serious.

 

Code:

import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.utility.Area;
		
@ScriptManifest(name = "", author = "", version = 1D, info="")
public class hi extends Script {

//your variable 
//bankArea
//tree area
//tree ints
//anything else you need
 
enum State {
CutTree, WalkToBank, Bank;
}
	
private State state;
public static Area bankArea = new Area(0, 0, 0, 0);//add your area with in here
public static Area treeArea = new Area(0, 0, 0, 0);// add your area here

			
public void onStart(){
 if (client.getInventory().isFull()){
state = State.WalkToBank;
 }
else if (myPlayer().isInArea(treeArea)){
state = State.CutTree;
}
 } 
		
public int onLoop() throws InterruptedException{
                        switch (state){
			case CutTree:
				return first();
			case WalkToBank:
				return second();
			case Bank:
				return third();
			}
		return random(10, 20);
		}
	
int first() throws InterruptedException {

if (myPlayer().isInArea(treeArea)) {
//Cut trees 
//and any other code you want to put here
}		
return 500;
}		

int second() throws InterruptedException{
if (client.getInventory().isFull()){	
if (!myPlayer().isInArea(bankArea)){
walk(bankArea);
}
else if (myPlayer().isInArea(bankArea)){
//interact with bank and so on
}
else if (client.getBank().isOpen()){
state = State.Bank;
}
}
return 200 + random(100,500);	
}			

int third() throws InterruptedException{
if (client.getBank().isOpen() && client.getInventory().isFull()){
//deposit all or what ever
}
else if (client.getBank().isOpen() && !client.getInventory().isFull()){
// close bank and do what ever you want.
}
else if (!client.getBank().isOpen() && client.getInventory().isFull()){
state = State.WalkToBank;
}
return 100;	
}
}
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.