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.

My first attempt to get back into scripting :)

Featured Replies

​So I used to script back in 2013 and even had a successful cooker used by many which achieved some 99's for users.

 

So I'm attempting to try and get back into it again, my java knowledge is poor, I just work through trial and error and using the API which just seems to work? LOL.

 

What am I making? Currently making a money making script which doesn't seem to be on the market or in the normal script section which I guess is a good thing?

 

Current Code: (Please give me tips etc where possible with explanation)

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.webwalk.INodeRouteFinder;
import org.osbot.rs07.event.WebWalkEvent;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.net.URL;
import java.awt.Image;


@ScriptManifest(author="Sponsor", version=0.01, info="Test", name="Super-Anti Collector", logo= "http://www.runehq.com/image/geitems/s/super-antipoison-3.gif")
public class antiCollect extends Script {


    //Paint
    private long timeStart;
    private int invCount = 0;
    private final BasicStroke stroke1 = new BasicStroke(1);
    private final Font font1 = new Font("Arial", 1, 18);
    private final Image img1 = getImage("http://www.runehq.com/image/geitems/s/super-antipoison-3.gif");
    private final Image img2 = getImage("http://i.imgur.com/b2EdUMF.png");
    private final Color color1 = new Color(204, 204, 204, 116);
    private final Color color2 = new Color(0, 0, 0);
    private final Color color3 = new Color(255, 0, 153);

    private final Area AREA_POTION = new Area(new Position(2465, 3175, 0), new Position(2470, 3179, 0));
    private final Area CWARS = new Area(new Position(2447, 3099, 0), new Position(2435, 3080, 0));

    INodeRouteFinder finder;


    private Image getImage(String url) {
        try {
            return ImageIO.read(new URL(url));
        } catch (IOException e) {
            return null;
        }
    }


    @Override
    public void onStart() throws InterruptedException {
        timeStart = System.currentTimeMillis();
        finder = INodeRouteFinder.createAdvanced();
        log("Starting Script :)");

    }

    @Override
    public int onLoop() throws InterruptedException {
        GroundItem Antipoison = groundItems.closest("Superantipoison(1)");
        RS2Object Chest = getObjects().closest("Bank chest");

        if (inventory.isFull() && bank.isOpen() && CWARS.contains(myPlayer())){
            bank.depositAll();
            sleep(random(1500,2500));
        } else {
        if (!inventory.isFull() && !AREA_POTION.contains(myPlayer())){
                WebWalkEvent webWalkEvent = new WebWalkEvent(finder, new Position(2467, 3176, 0));
                execute(webWalkEvent);
        } else {
            if (Antipoison != null) {
                Antipoison.interact("Take");
                invCount += 1;
                sleep(random(2000, 4000));
            } else {
                if (inventory.isFull() && !CWARS.contains(myPlayer())){
                    WebWalkEvent webWalkEvent = new WebWalkEvent(finder, new Position(2443, 3083, 0));
                    execute(webWalkEvent);
                } else {
                    if (inventory.isFull() && !bank.isOpen() && CWARS.contains(myPlayer())){
                        if (Chest != null){
                            Chest.interact("Use");
                            sleep(random(1500,2500));
                        }

                        }
                    }
                }
            }
        }

        return 100;
    }

    @Override
    public void onPaint(Graphics2D g) {

        long timeElapsed = System.currentTimeMillis() - timeStart;
        long seconds = (timeElapsed / 1000) % 60;
        long minutes = (timeElapsed / (1000 * 60)) % 60;
        long hours = (timeElapsed / (1000 * 60 * 60)) % 24;

        g.setColor(color1);
        g.fillRoundRect(554, 214, 177, 248, 16, 16);
        g.setColor(color2);
        g.setStroke(stroke1);
        g.drawRoundRect(554, 214, 177, 248, 16, 16);
        g.drawImage(img1, 535, 375, null);
        g.drawImage(img1, 654, 210, null);
        g.drawImage(img2, 101, 5, null);
        g.setFont(font1);
        g.setColor(color3);
        g.drawString("Time : " + (hours >= 10 ? "" + hours : "0" + hours) + ":" + (minutes >= 10 ? "" + minutes
                : "0" + minutes) + ":" + (seconds >= 10 ? "" + seconds : "0" + seconds), 565, 325);
        g.drawString("Collected : " + invCount, 563, 346);
        g.drawString("Profit :", 562, 368);

    }


    @Override
    public void onExit() throws InterruptedException {
        this.log("We have finished");
    }
}

XW5oK4Q.png

 

Progress:

​Script Skeleton

​Looting

Walking (web walking)

​Areas

Banking

​Paint

 

 

To Do:

Profit Calculations to paint from RSBUDDY

Teleportation for quicker banking

World hopping for faster looting

Some Anti-Ban

Improve layout

 

Thanks to everyone which has posted snippets and tuts!!

Edited by Sponsor

Goodluck! Just a minor note, you shouldn't be using Antipoison but antipoison, just something programmers hate when declaring variables :D

  • Author

Goodluck! Just a minor note, you shouldn't be using Antipoison but antipoison, just something programmers hate when declaring variables :D

 

Haha, Okay I'll change it.

 

A generally reason for this or just because it looks nicer? haha?

Good luck with this i actually had same idea yesterday when i was doing a quest i saw the area where super anti spawns and was thinking what if u collected those could it be decent profit (if world hop etc ofc).

You could make the code look a bit cleaner if you avoid instantiating the INodeRouteFinder and WebWalkEvent and just use the default webWalk method. Good luck with the script :ditto:

 

The comment above refers to the Java naming conventions which state that class names begin with uppercase letters and field/method names begin with lowercase letters. Every first letter in the following word is to be capitalized and multiword method/class/field labels are to be written without any spaces or underscores.

Haha, Okay I'll change it.

 

A generally reason for this or just because it looks nicer? haha?

java conventions 

 

​So I used to script back in 2013 and even had a successful cooker used by many which achieved some 99's for users.

 

So I'm attempting to try and get back into it again, my java knowledge is poor, I just work through trial and error and using the API which just seems to work? LOL.

 

 

This is a good way to learn at the beginning.

 

Good luck to you.

 

 

 

 

I can't take new projects right now, but if you need some scripting help with a quick answer, you can join my discord chatroom. (Its a web chatroom, allows me to speak over mic, and you to type back to me): (removed discord link at Maldesto request)

Edited by DragonAlpha

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.