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 bot - not starting issue

Featured Replies

package Clayminer;

 
import java.awt.Graphics2D;
 
import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
@ScriptManifest(author = "Spooder", info = "Mines clay in varrock west", logo = "", name = "ClayMiner + banking", version = 1)
 
public class ClayMiner extends Script {
final int clay = 7454;
final Area CLAY_AREA = new Area(3183, 3378, 3183, 3378);
final Area BANK_AREA = new Area(3185, 3445, 3182, 3436);
Inventory inven = getInventory();
Player player = myPlayer();
Bank bank = getBank();
 
@Override
public void onStart() {
log("The Script has started");
}
 
 
 
@Override
public int onLoop() throws InterruptedException {
getWalking().webWalk(CLAY_AREA);
if (!inven.isFull()) {
if (CLAY_AREA.contains(player)) {
if (!player.isMoving()) {
if (!player.isAnimating()) {
Entity rock = getObjects().closest(clay);
if (rock != null) {
rock.interact("mine");
sleep(random(50, 120));
}
}
 
}
 
 
}
 
 
if (inven.isFull()) {
getWalking().webWalk(BANK_AREA);
if (BANK_AREA.contains(player)) {
if (!getBank().isOpen()) {
getBank().open();
} else {
bank.deposit(434, 28);
}
}
}
 
return 80;
}
 
@Override
public void onPaint(Graphics2D g) {
 
}
@Override
public void onExit() {
 
}
}
 
 
 
 
 
 
Since i dont know how people bring in the script i just copied and pasted. If you cant already see, this script is very scrubby, because this is my first ever attempt at writing a script, not sure why its not starting. Look forward to a solution. Thanks
Inventory inven = getInventory();
Player player = myPlayer();
Bank bank = getBank();
Remove these and your script will be able to start.

 

  • Author

It Started yes thank you, but it doesnt do anything hahaha, my scriping lvls are not dank enuf yet, can anyone find my error?

Maybe change the onloop return to 600 - 1000 instead of 80 

 

Also it seems like you are 

getWalking.webwalk(clayarea)

Every single time you go through the loop, which is bad.

 

I also tend to use RS2Object instead of Entity , May not be necessary though  

Edited by Waffe

  • Author
package Clayminer;

 

import java.awt.Graphics2D;

 

import org.osbot.rs07.api.Bank;

import org.osbot.rs07.api.Inventory;

import org.osbot.rs07.api.map.Area;

import org.osbot.rs07.api.model.Entity;

import org.osbot.rs07.api.model.Player;

import org.osbot.rs07.api.model.RS2Object;

import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;

 

@ScriptManifest(author = "Spooder", info = "Mines clay in varrock west", logo = "", name = "ClayMiner + banking", version = 1)

 

public class ClayMiner extends Script {

final int clay = 7454;

final Area CLAY_AREA = new Area(3183, 3378, 3183, 3378);

final Area BANK_AREA = new Area(3185, 3445, 3182, 3436);

 

 

@Override

public void onStart() {

log("The Script has started");

}

 

 

 

@Override

public int onLoop() throws InterruptedException {

 

if (!inventory.isFull()) {

if (CLAY_AREA.contains(myPlayer())) {

if (!myPlayer().isMoving()) {

if (!myPlayer().isAnimating()) {

RS2Object rock = getObjects().closest(clay);

if (rock != null) {

rock.interact("mine");

sleep(random(50, 120));

}

}

 

}else{

sleep(1000);

}

 

} else{

getWalking().webWalk(CLAY_AREA);

}

 

}

 

 

if (inventory.isFull()) {

getWalking().webWalk(BANK_AREA);

if (BANK_AREA.contains(myPlayer())) {

if (!getBank().isOpen()) {

getBank().open();

} else {

bank.deposit(434, 28);

}

}

}

 

return 800;

}

 

@Override

public void onPaint(Graphics2D g) {

 

}

@Override

public void onExit() {

 

}

}

 

 

 

 

I changed it up a little bit but im guessing that the myPlayer(), is not grabbing my player, because when i start the script he does absolutely nothing.

 

package Clayminer;
 
import java.awt.Graphics2D;
 
import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
@ScriptManifest(author = "Spooder", info = "Mines clay in varrock west", logo = "", name = "ClayMiner + banking", version = 1)
 
public class ClayMiner extends Script {
final int clay = 7454;
final Area CLAY_AREA = new Area(3183, 3378, 3183, 3378);
final Area BANK_AREA = new Area(3185, 3445, 3182, 3436);
 
 
@Override
public void onStart() {
log("The Script has started");
}
 
 
 
@Override
public int onLoop() throws InterruptedException {
 
if (!inventory.isFull()) {
if (CLAY_AREA.contains(myPlayer())) {
if (!myPlayer().isMoving()) {
if (!myPlayer().isAnimating()) {
RS2Object rock = getObjects().closest(clay);
if (rock != null) {
rock.interact("mine");
sleep(random(50, 120));
}
}
 
}else{
sleep(1000);
}
 
} else{
getWalking().webWalk(CLAY_AREA);
}
 
}
 
 
if (inventory.isFull()) {
getWalking().webWalk(BANK_AREA);
if (BANK_AREA.contains(myPlayer())) {
if (!getBank().isOpen()) {
getBank().open();
} else {
bank.deposit(434, 28);
}
}
}
 
return 800;
}
 
@Override
public void onPaint(Graphics2D g) {
 
}
@Override
public void onExit() {
 
}
}
 
 
 
 
I changed it up a little bit but im guessing that the myPlayer(), is not grabbing my player, because when i start the script he does absolutely nothing.

 

You should put logs every where in your code and see which logs execute and which ones don't. Simple debug technique

http://osbot.org/forum/topic/58775-a-beginners-guide-to-writing-osbot-scripts-where-to-get-started-by-apaec/

 

Learn how to do states.

 

Also, you use nested if statements instead of just having it neater with a single if statement.

if (!inventory.isFull()) {
if (CLAY_AREA.contains(myPlayer())) {
if (!myPlayer().isMoving()) {
if (!myPlayer().isAnimating()) {
RS2Object rock = getObjects().closest(clay);
if (rock != null) {
rock.interact("mine");
sleep(random(50, 120));
}
}
 

Can go to

Entity clay = objects.closest(clay)
if(!inventory.isFull() && CLAY_AREA.contains(myPlayer()) && !myPlayer().isMoving() && !myPlayer().isAnimating() && clay!=null)
{
clay.interact("mine");
sleep(random(1250,1500));
}
  • Author

adding the logs made it work some how, even tho its shoulda have oh well thanks for the help


ok thanks for the notes, about the ifs, i have 1 more question about this bot, when i mine the clay i want it to stay at the most northern clay in varrock west so i dont get attacked by the mugger, how would i make it stay just on that one, because its doing find closest clay and then running the one south, and then running back up cuz it checks that its not in the clay area and runs back north, which will get banned really fast, how do i fix that?

adding the logs made it work some how, even tho its shoulda have oh well thanks for the help

ok thanks for the notes, about the ifs, i have 1 more question about this bot, when i mine the clay i want it to stay at the most northern clay in varrock west so i dont get attacked by the mugger, how would i make it stay just on that one, because its doing find closest clay and then running the one south, and then running back up cuz it checks that its not in the clay area and runs back north, which will get banned really fast, how do i fix that?

 

Make an area around only the clay rocks you want it to be at, so lets say its

final Area CLAY_NORTH = new Area (1 , 10, 2, 20);

you would do Entity clay = objects.closest(CLAY_NORTH, "Rocks"); so that way it's only checking for that area.

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.