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.

Beginner noob problems

Featured Replies

Heya I just wanted to ask how I could make it that my Player does stop if he interact with the Rock (mining) I could put sleeping on like 10 secs but I want to that he not waits 10 sec even he mined the rock after 2 secs.

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
 
@ScriptManifest(author = "Someone", info = "Testing", name = "Mining Test", logo = "", version = 0)
public class main extends Script {
 
public void onStart() {
log("Shitty test");
}
 
private enum State {
MINE, DROP, WAIT
};
            
private State getState() throws InterruptedException {
Entity stall = objects.closest("Rocks");
        inventory.dropAllExcept(1265);
        sleep(random(1000));
if (stall != null)
return State.MINE;
return State.WAIT;
}
 
public int onLoop() throws InterruptedException {
switch (getState()) {
case MINE:
Entity stall = objects.closest("Rocks");
if (stall != null) {
stall.interact("Mine");
}
break;
case DROP:
inventory.dropAll();
break;
case WAIT:
sleep(random(500, 700));
break;
}
return random(200, 300);
}
 
public void onExit() {
log("Test more");
}
 
public void onPaint(Graphics2D g) {
 
}
 
}
 
 
Thanks for any help.
~Life
case MINE:
    Entity stall = objects.closest("Rocks");
    if (stall != null && !myPlayer().isAnimating()) {
        stall.interact("Mine");
    }
break;

Replace your current mine state with my version.

  • Author
case MINE:
    Entity stall = objects.closest("Rocks");
    if (stall != null && !myPlayer().isAnimating()) {
        stall.interact("Mine");
    }
break;

Replace your current mine state with my version.

 

Tyvm saved my day :)

Vilius answered your question really well, but as a side note, you might want to have a look into condition sleeping. It can be very useful. 

 

For instance, say you want to drop everything except for a certain ore, you could write:

if(inventory.isFull()) {
      inventory.dropAllExcept(2958);
      new ConditionalSleep(10000) {
	    @[member=Override]
						
	    public boolean condition() throws InterruptedException {
			return inventory.onlyContains(2958);
			}
	    }.sleep();
}

This would, if your inventory is full, drop everything except for item ID 2958, and sleep until your inventory only contains item ID 2958.

 

If after 10000 ms your inventory still does not only contain 2958 (if the script failed to drop something for some reason), it will repeat, trying to drop everything and sleeping until the condition of "inventory.onlyContains(2958)" is met.

 

  • Author

Vilius answered your question really well, but as a side note, you might want to have a look into condition sleeping. It can be very useful. 

 

For instance, say you want to drop everything except for a certain ore, you could write:

if(inventory.isFull()) {
      inventory.dropAllExcept(2958);
      new ConditionalSleep(10000) {
	    @[member='Override']
						
	    public boolean condition() throws InterruptedException {
			return inventory.onlyContains(2958);
			}
	    }.sleep();
}

This would, if your inventory is full, drop everything except for item ID 2958, and sleep until your inventory only contains item ID 2958.

 

If after 10000 ms your inventory still does not only contain 2958 (if the script failed to drop something for some reason), it will repeat, trying to drop everything and sleeping until the condition of "inventory.onlyContains(2958)" is met.

Okay cool  I understand thanks!

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.