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.

Featured Replies

It's a basic short and simple system. I'm learning the API so please if you have any additional ideas and things to add or guides or anything I can use to better myself and my scripts please PM me or reply here!!

 

Script Features:

  • Camera Movement
  • Picks up full inventory of Bones to bury

Hoping to add more!

 

Jar: https://mega.nz/#!1R11TTjJ!WkjkMtG6EU-c-k0StJGnVVLgA4nIUiGP1xP4tTJwBnM

Raw: https://paste.ee/p/2ZRLP

package main.script;

import java.awt.Graphics2D;

import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Booleans Yay", info = "Bone burying made ez pz", name = "Bone Bury", version = 1, logo = "")

public class BoneBury extends Script
{

	@[member='Override']
	public void onStart(){}
	
	private enum BotState
	{
		PICKUP, BURY
	};

	private BotState getState()
	{
		return inventory.isFull() ? BotState.BURY : BotState.PICKUP;
	}
	
	@[member='Override']
	public int onLoop() throws InterruptedException
	{
		switch (getState())
		{
		case PICKUP:
			if (!myPlayer().isAnimating())
			{
				GroundItem bone = groundItems.closest("Bones");
				if (bone != null)
				{
					bone.interact("Take");
					Thread.sleep(random(1500));
				}
			}
			break;
		case BURY:
			camera.moveYaw(random(360));
			while (!inventory.isEmpty())
			{
				Item bones = inventory.getItem("Bones");
				if (bones != null)
				{
					bones.interact("Bury");
					if (myPlayer().isAnimating())
					{
						bones.interact("Bury");
						Thread.sleep(random(200));
					}
				}
			}
			break;
		}
		return random(200, 300);
	}

	@[member='Override']
	public void onExit(){}

	@[member='Override']
	public void onPaint(Graphics2D g){}
}

Edited by booleans yay

Everything is fine and dandy, but personally the code style of how you put braces is what saddens me the most, also the state framework you have is the cause for some spaghetti code.

But instead of using just simple sleeps, try looking into the ConditionalSleep class of OSBot.

Just my two cents :xfeels:

  • Author

Thanks, could you tell me the calling to implement it please?

 

Also why is this moved to "Help"? This code is fully functional; just needed input/advice..

Will sleep until the inventory is empty or until 5.5 seconds have passed. Look into using this in your scripts as it is a lot better than regular sleeps. 

Also as Vilius stated, the bracket placement is off and makes it harder to read. 


  new ConditionalSleep(5500) {
                        @ Override
                        public boolean condition() throws InterruptedException {
                            return a.getInventory().isEmpty();
                        }
                    }.sleep();


Overall, not bad for your first script

Edited by Juggles

This isn't bad for a first script. However, a more efficient way of burying would be:

while(inventory.contains("Bones")) {
 inventory.interact("Bury", "Bones");
}

Also, look into conditionalsleeps.

				if (bone != null) {
					bone.interact("Take");
					Thread.sleep(random(1500));
				}

could be:

long boneCount = inventory.getAmount("Bones");
new ConditionalSleep(5000) {
   @ Override
   public boolean evaluate() {
        return inventory.getAmount("Bones") > boneCount;
   }
}.sleep();

This will sleep until you have more bones, or until 5 seconds have passed. Very useful in situations like this.

 

Also, this is java! Please never use that brace formation!

  • Author

Thanks for the usage. I've updated since. And reading other threads for ideas and usages to improve myself further! :)

Hopefully when I'm finished this, it will be available in the SDN or repo for the free scripts.

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.