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.

Can't get this to compile

Featured Replies

Someone had posted a warrior tokens script in Local, but I can't get it to compile. Code as follows:

 

 

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
import java.util.Random;
 
import org.osbot.rs07.api.Skills; 
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.NPCS;
 
import java.awt.*;
 
@ScriptManifest(author = "You", info = "My first script", name = "MegaWGuild", version = 0, logo = "")
public class MegaWGuild extends Script {
int randomHealth = random(30, 40);
public static int foodId = 385;
public static int helmId = 1159;
public static int bodyId = 1121;
public static int legsId = 1071;
public static int tokenId = 8851;
public static String goatName = "Animated Mithril Armour";
 
    @Override
    public void onStart() {
        log("Let's get started!");
    }
 
    @Override
    public int onLoop() throws InterruptedException {
     if ((this.inventory.contains(new int[] { foodId })) && (!myPlayer().isMoving())) {
    if (!myPlayer().isMoving())
       {
    NPC goat = (NPC)this.npcs.closest(new String[] {goatName});
    GroundItem helm = (GroundItem)this.groundItems.closest(new int[] {helmId });
    GroundItem body = (GroundItem)this.groundItems.closest(new int[] {bodyId });
    GroundItem legs = (GroundItem)this.groundItems.closest(new int[] {legsId });
    GroundItem token = (GroundItem)this.groundItems.closest(new int[] {tokenId });
    if (currentHealth() < randomHealth) {
              eat();
              sleep(random(300, 500));
             }
    else if ((goat != null) && (!goat.isUnderAttack())) {
    goat.interact(new String[] { "Attack" });
                 sleep(random(1000, 1500));
    }
    else if (body != null){ 
    takeGroundItem(bodyId);
    }
    else if (helm != null){ 
    takeGroundItem(helmId);
        }
    else if (legs != null){ 
    takeGroundItem(legsId);
        }
    else if (token != null){ 
    takeGroundItem(tokenId);
    sleep(random(100, 400));
        }
    else if ((helm == null) && (legs == null) && (body == null) && (token == null))  {
    Item use = this.inventory.getItem(new int[] {bodyId });
    use.interact(new String[] { "Use"});
    sleep(random(100, 500));
    RS2Object tile = this.objects.closest(new String[] { "Magical Animator" });
    tile.interact(new String[] { "Use"});
    sleep(random(2000, 3000));
    } 
    }
     }
      return random(200, 300);
    }
    
 
private void eat() {
Item food = this.inventory.getItem(new int[] {foodId });
food.interact(new String[] { "Eat" });
}
 
int currentHealth() {
int percperone = 100 / this.skills.getStatic(Skill.HITPOINTS);
return percperone * this.skills.getDynamic(Skill.HITPOINTS);
}      
 
private void takeGroundItem(int id)
    {
      try
      { 
        GroundItem horn = (GroundItem)this.groundItems.closest(new int[] { id });
        
        horn.interact(new String[] { "Take" });
        
        sleep(random(1200, 1500));
      }
      catch (Exception localException) {}
    }
 
    @Override
    public void onExit() {
        log("Thanks for running my Warrior Guild script!");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
 
}

Hopefully this works but completely untested.

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
import java.util.Random;
 
import org.osbot.rs07.api.Skills; 
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.NPCS;
 
import java.awt.*;
 
@ScriptManifest(author = "You", info = "My first script", name = "MegaWGuild", version = 0, logo = "")
public class main extends Script {
int randomHealth = random(30, 40);
public static int foodId = 385;
public static int helmId = 1159;
public static int bodyId = 1121;
public static int legsId = 1071;
public static int tokenId = 8851;
public static String goatName = "Animated Mithril Armour";
 
    @Override
    public void onStart() {
        log("Let's get started!");
    }
 
    @Override
    public int onLoop() throws InterruptedException {
     if ((this.inventory.contains(new int[] { foodId })) && (!myPlayer().isMoving())) {
    if (!myPlayer().isMoving())
       {
    NPC goat = (NPC)this.npcs.closest(new String[] {goatName});
    GroundItem helm = (GroundItem)this.groundItems.closest(new int[] {helmId });
    GroundItem body = (GroundItem)this.groundItems.closest(new int[] {bodyId });
    GroundItem legs = (GroundItem)this.groundItems.closest(new int[] {legsId });
    GroundItem token = (GroundItem)this.groundItems.closest(new int[] {tokenId });
    if (currentHealth() < randomHealth) {
              eat();
              sleep(random(300, 500));
             }
    else if ((goat != null) && (!goat.isUnderAttack())) {
    goat.interact(new String[] { "Attack" });
                 sleep(random(1000, 1500));
    }
    else if (body != null){ 
    takeGroundItem(bodyId);
    }
    else if (helm != null){ 
    takeGroundItem(helmId);
        }
    else if (legs != null){ 
    takeGroundItem(legsId);
        }
    else if (token != null){ 
    takeGroundItem(tokenId);
    sleep(random(100, 400));
        }
    else if ((helm == null) && (legs == null) && (body == null) && (token == null))  {
    Item use = this.inventory.getItem(new int[] {bodyId });
    use.interact(new String[] { "Use"});
    sleep(random(100, 500));
    RS2Object tile = this.objects.closest(new String[] { "Magical Animator" });
    tile.interact(new String[] { "Use"});
    sleep(random(2000, 3000));
    } 
    }
     }
      return random(200, 300);
    }
    
 
private void eat() {
Item food = this.inventory.getItem(new int[] {foodId });
food.interact(new String[] { "Eat" });
}
 
int currentHealth() {
int percperone = 100 / this.skills.getStatic(Skill.HITPOINTS);
return percperone * this.skills.getDynamic(Skill.HITPOINTS);
}      
 
private void takeGroundItem(int id)
    {
      try
      { 
        GroundItem horn = (GroundItem)this.groundItems.closest(new int[] { id });
        
        horn.interact(new String[] { "Take" });
        
        sleep(random(1200, 1500));
      }
      catch (Exception localException) {}
    }
 
    @Override
    public void onExit() {
        log("Thanks for running my Warrior Guild script!");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
 
}

Download: http://uppit.com/jrz67pk733ba/OSBOT_Script.jar

 

I've compiled it for you. It looks kinda outdated through so I'd recommend you re-write it or something.

Edited by steve498

Looks decompiled..

 

Impossible. Decompilers output more consistent code with better formatting. This code has been decompiled, forced through a cats anus, spat on, told to kill itself, and, to top it all off, compiled and decompiled again.

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.