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.

I need to know some things

Featured Replies

 Hey guys,

I'm making my first script and I have a question:
 
  - How can I select something like a chair after it clicks on build chairspace (picture 1)

 

this is my code:

 

 

package core;

 
import nodes.TabMaking;
import nodes.Unnoting;
 
import org.osbot.rs07.api.Mouse;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.Option;
import org.osbot.rs07.input.mouse.ClickMouseEvent;
import org.osbot.rs07.input.mouse.EntityDestination;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
import utils.Walking;
 
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
@ScriptManifest(name = "JonesConstruction", author = "Jones", version = 0.1, info = "Construction Script made by Jones", logo = "")
public class JonesConstruction extends Script {
private String status = "";
 
 
@Override
public void onStart() {
 
 
}
 
private enum State {
GOING_OUTSIDE,GOING_INSIDE, SEARCHING_CHAIR, MAKING_CHAIRS, UNNOTING, WAITING
};
 
private State getState() {
Entity portal = objects.closest("Portal");
if (inventory.contains(960)) {
if (myPlayer().getX() > 12000) {
if(myPlayer().isAnimating()){
return State.MAKING_CHAIRS;
}else{ return State.SEARCHING_CHAIR;}
 
}else{
return State.GOING_INSIDE;
}else{
if(myPlayer().getX() > 12000) {
return State.GOING_OUTSIDE;
}else{
return State.UNNOTING;
}
}
 
 
 
}
 
@Override
public int onLoop() throws InterruptedException {
switch(getState()){
case GOING_INSIDE:
log("Searching for portal");
Entity portal = objects.closest("Portal");
if(portal != null ){
portal.interact("Enter");
sleep(random(1000,1250));
keyboard.typeString("2");
sleep(random(1000,1500));
}
break;
 
case SEARCHING_CHAIR:
log("Searching for Chair space");
Entity chairSpace = objects.closest(4517);
 
while(!inventory.isEmptyExcept(961, 995, 4820, 8794,2347)){
if(chairSpace != null){
chairSpace.interact("Build");
Entity rockingChair = objects.closest("Rocking chair");
rockingChair.interact("Build");
Entity chair = objects.closest("Chair");
chair.interact("Remove");
keyboard.typeString("1");
}
}
break;
case GOING_OUTSIDE:
log("Searching for portal");
portal = objects.closest("Portal");
portal.interact("Enter");
break;
case UNNOTING:
inventory.interact(961,"Use");
if(inventory.isItemSelected()){
NPC Phials = npcs.closest(1614);
keyboard.typeString("3");
}
break;
default:
break;
}
return random(200,300);
 
}
 
private boolean hoverEntityOption(Entity entity, String option) throws InterruptedException {
   if(entity == null)
       return false;
 
   if(menu.isOpen()) {
       List<Option> options = menu.getMenu();
 
       if(options != null) {
           Rectangle optionRec = null;
    
           for(int index = 0; index < options.size(); index++) {
               if(options.get(index).action.equals(option)) {
                   optionRec = menu.getOptionRectangle(index);
 
                   if(optionRec != null) {
                       if(!optionRec.contains(mouse.getPosition())) {
                           int x = menu.getX() + Script.random(10, 160);
                           int y = menu.getY() + 23 + index * 15;
                           Script.sleep(Script.random(200, 400));
                           return mouse.move(x, y);
                       }
                   }
               }
           }
       }
   } else {
       EntityDestination ed = new EntityDestination(bot, entity);
       mouse.click(ed, true);
   }
 
   return false;
}
}
 

 

I hope some people can help me and give me some tips on how to program better. 

THANKS A LOT!

post-167351-0-08199800-1436826015_thumb.png

Use widgets. On the client go to the setting. Enable widget debugger. Simply just interact with the widget

RS2Widget w = widgets.get(int parent id, int child id); //parennt and child ids can be found using widget debugger in settings tab
if (w != null && w.isVisible())
    w.interact("Build"); //or whatever the action is

PS in future, post code using the code button not the quote button :)

 

apa

RS2Widget w = widgets.get(int parent id, int child id); //parennt and child ids can be found using widget debugger in settings tab
if (w != null && w.isVisible())
    w.interact("Build"); //or whatever the action is

PS in future, post code using the code button not the quote button smile.png

 

apa

 

or just force left click with

 w.interact();

Create an account or sign in to comment

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.