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.

Script does not run

Featured Replies

Hi i create myself Script but when i build jar and "Start local" Script does not run can anyone help me solve this? What am I doing wrong?

 

package me.ywsmithing;

import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import java.awt.*;

@ScriptManifest(name = "YW_Smithing", info = "Smithing from Ore to Bars", author = "YmirWork", version = 0.1, logo = "")
public class Main extends Script{

    private Area smeltingArea = new Area(3105, 3501, 3110, 3496),
            bankArea = Banks.EDGEVILLE,
            exchangeArea = Banks.GRAND_EXCHANGE;   // Area(3160, 3484, 3169, 3494);

    NPC bank = getNpcs().closest("Banker");
    NPC clerk = getNpcs().closest("Grand Exchange Clerk");

    long coins = 100;
    int silverBarsSell = 75;
    int silverOre = 28;

    @Override
    public void onStart() throws InterruptedException {
        log("Starting Script");
    }
    @Override
    public int onLoop() throws InterruptedException
    {
        walkToBankArea();
        openBank();
        withdrawItems();
        smelting();
        bankDeposit();
        return random(1200 , 1800);
    }


    public void bankDeposit()
    {
        if (inventory.getAmount("Silver Bar") == 14 && !inventory.contains("Silver Ore") && bankArea.contains(myPosition()) && bank != null && getBank().isOpen())
        {
            log("Deposit Silver Bar");
            getBank().depositAll("Silver Bar");
            new ConditionalSleep(3000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return !inventory.contains("Silver Bar");
                }
            }.sleep();
        }

    }

    public void walkToBankArea(){
        if(inventory.isEmpty() || inventory.getAmount("Silver Bar") == 14 && !bankArea.contains(myPosition())){
            log("Walking to Bank Area");
            getWalking().webWalk(bankArea);
            new ConditionalSleep(2000){
                @Override
                public boolean condition() throws InterruptedException{
                    return bankArea.contains(myPosition());

                }
            }.sleep();
        } else if (bankArea.contains(myPosition()) && bank != null && !bank.isVisible() ) {
            getCamera().toEntity(bank);

        }
    }
    public void withdrawItems()
    {
        if(inventory.isEmpty() && bankArea.contains(myPlayer()) && bank != null && getBank().isOpen())
        {
            log("Withdraw Silver Ore");
            getBank().withdrawAll("Silver Ore");
            new ConditionalSleep(3000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return inventory.contains("Silver Ore");
                }
            }.sleep();
        }

    }

    public void openBank(){
        if ((inventory.isEmpty() || (inventory.getAmount("Silver bar") == 14) && bankArea.contains(myPlayer()) && bank != null && bank.isVisible() && !getBank().isOpen())){
            log("Open Bank");
            bank.interact("Bank");
            new ConditionalSleep(5000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getBank().isOpen();
                }
            }.sleep();
        }
    }

    public void smelting()
    {
        RS2Object furnace = getObjects().closest("Furnace");
        RS2Widget silverWidget = getWidgets().get(270, 17, 29);
        if(inventory.contains("Silver Ore") && !smeltingArea.contains(myPlayer()))
        {
            log("Walking to Smealting Area");
            getWalking().webWalk(smeltingArea);
            new ConditionalSleep(30000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return smeltingArea.contains(myPlayer());
                }
            }.sleep();

        }
        else if (smeltingArea.contains(myPlayer()) && furnace != null && !furnace.isVisible())
        {
            getCamera().toEntity(furnace);
        }
        if(inventory.contains("Silver Ore") && smeltingArea.contains(myPlayer()) && furnace != null && silverWidget == null && !myPlayer().isAnimating() && furnace.isVisible())
        {
            log("Start Smelting ");
            furnace.interact("Smelt");
            new ConditionalSleep(5000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getDialogues().isPendingContinuation() || silverWidget != null;
                }
            }.sleep();
        }else if (inventory.contains("Silver Ore") && smeltingArea.contains(myPlayer()) && !myPlayer().isAnimating() && silverWidget != null)
        {
            silverWidget.interact();
            new ConditionalSleep(60000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return !inventory.contains("Silver Ore") || getDialogues().isPendingContinuation();
                }
            }.sleep();
        }


    }
    @Override
    public void onExit() throws InterruptedException {
        log("Stopping Script.");
    }

    @Override
    public void onPaint(Graphics2D g) {

    }

}

 

  • Author
44 minutes ago, Khaleesi said:

You can't do this there, you have to do this in your onLoop:

NPC bank = getNpcs().closest("Banker");
NPC clerk = getNpcs().closest("Grand Exchange Clerk");

 

Ohh.... Thats right Thanks ! <3
Close topic

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.