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.

Simple feather looter.

Featured Replies

So I just started to learn java and scripting, is there someone out there who can make or share simple looting script with all it needs? I mean the api lines and such. I want to begin with simple feather looter. 

 

So i readed a bit and used someones else script to get one feather looter working but i couldnt. Atm i got this but there are still some errors and i dont know how to fix em, doh...   Wish i could get 1 working looting script so i can change it myself and stuff.

 

 

import java.awt.*;

import org.osbot.rs07.script.ScriptManifest;
 
 
@ScriptManifest(author = "FFTL",
info = "First",
name = "main",
version = 1.0,
logo = "")
 
 
{
private State state;
 
 
 
    enum State {
 
        LOOTING;
 
    }
 
 
 
    public void getState() {
 
        GroundItem feather = closestGroundItemForName("Feather");
 
        if (feather != null) {
 
            if (feather.isVisible()) {
 
                state = State.LOOTING;
 
            }
 
        }
 
    }
 
 
 
    private GroundItem closestGroundItemForName(String string) {
 
return null;
}
 
 
 
public int onLoop() throws InterruptedException {
 
        getState();
 
        switch (state) {
 
            case LOOTING:
 
                return lootFeather();
 
        }
 
        return random(20, 50);
 
    }
 
 
 
    private int random(int i, int j) {
 
return 0;
}
 
 
 
public int lootFeather() throws InterruptedException{
 
 
 
        GroundItem feather = closestGroundItemForName("Feather");
 
                                   
 
        feather.interact("Take");
 
 
 
        return 2500;
 
    }
 
 
 
    public void pickUpFeathers() {
 
   
 
        
 
    }
 
}

 


Its giving me errors on:
 

private State state;          -   Syntax error on tokens, delete these tokens

   

enum State {                           -    Multiple markers at this line

                                                          Illegal modifier for the enum State; only public is 
                                                           permitted

   

case LOOTING:                  -       Type mismatch: cannot convert from State to int

So I just started to learn java and scripting, is there someone out there who can make or share simple looting script with all it needs? I mean the api lines and such. I want to begin with simple feather looter. 

 

So i readed a bit and used someones else script to get one feather looter working but i couldnt. Atm i got this but there are still some errors and i dont know how to fix em, doh...   Wish i could get 1 working looting script so i can change it myself and stuff.

 

 

Its giving me errors on:

 

private State state;          -   Syntax error on tokens, delete these tokens

   

enum State {                           -    Multiple markers at this line

                                                          Illegal modifier for the enum State; only public is 
                                                           permitted

   

case LOOTING:                  -       Type mismatch: cannot convert from State to int

 

Please format your code properly if you are going to post it in the Scripting help section. Otherwise it is a pain to read..

 

I strongly suggest you learn the basics of Java first. You haven't even declared your "class" as a class. There are a lot of issues in this script not due to your lack of understanding of the API, but due to your lack of Java / programming knowledge.

 

Does this help you buddy?

@ScriptManifest(author = "FFTL", info = "First", name = "main", version = 1.0, logo = "")
public class FFTLFeathers extends Script {
    private State state;

    public enum State {

        LOOTING, WALKING, FILLTHISINMAN

    }

    @Override
    public int onLoop() throws InterruptedException {
        getState();
        switch (state) {
            case LOOTING:
                lootFeather();
                break;
        }
        return 750;
    }

    private void getState() {
        final GroundItem feather = closestGroundItemForName("Feather");

        if (feather != null) {
            if (feather.isVisible()) {
                state = State.LOOTING;
            }
        }
    }

    public void lootFeather() {
        GroundItem feather = closestGroundItemForName("Feather");
        if (feather != null)
            feather.interact("Take");
    }

    private GroundItem closestGroundItemForName(final String name) {
        final GroundItems groundItems = new GroundItems();
        final List<GroundItem> list = groundItems.filter(new NameFilter<>(name));
        for (GroundItem g : list) {
            if (g.isOnScreen() && g.exists()) { //You could implement a null-check here
                return g;
            }
        }
        return null;
    }
}

Edit: not so familiar with the API yet, let me know if there are better ways lol.

 

Edited by KEVzilla

Does this help you buddy?

@ScriptManifest(author = "FFTL", info = "First", name = "main", version = 1.0, logo = "")
public class FFTLFeathers extends Script {
    private State state;

    public enum State {

        LOOTING, WALKING, FILLTHISINMAN

    }

    @Override
    public int onLoop() throws InterruptedException {
        getState();
        switch (state) {
            case LOOTING:
                lootFeather();
                break;
        }
        return 750;
    }

    private void getState() {
        final GroundItem feather = closestGroundItemForName("Feather");

        if (feather != null) {
            if (feather.isVisible()) {
                state = State.LOOTING;
            }
        }
    }

    public void lootFeather() {
        GroundItem feather = closestGroundItemForName("Feather");
        if (feather != null)
            feather.interact("Take");
    }

    private GroundItem closestGroundItemForName(final String name) {
        final GroundItems groundItems = new GroundItems();
        final List<GroundItem> list = groundItems.filter(new NameFilter<>(name));
        for (GroundItem g : list) {
            if (g.isOnScreen() && g.exists()) {
                return g;
            }
        }
        return null;
    }
}

Edit: not so familiar with the API yet, let me know if there are better ways lol.

 

Your code can be simplified / improved to:

import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "FFTL", info = "First", name = "main", version = 1.0, logo = "")
public class FFTLFeathers extends Script {

    @Override
    public int onLoop() throws InterruptedException {
        
        long featherCount = getInventory().getAmount("Feather");
        GroundItem feather = getGroundItems().closest("Feather");
        if(feather != null){
            
            feather.interact("Take");
            new ConditionalSleep(5000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getInventory().getAmount("Feather") > featherCount;
                }
            }.sleep();
        }
        return 750;
    }
}

But that is besides the point. He needs to learn Java xD

Edited by Explv

Your code can be simplified / improved to:

import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "FFTL", info = "First", name = "main", version = 1.0, logo = "")
public class FFTLFeathers extends Script {

    @Override
    public int onLoop() throws InterruptedException {
        
        long featherCount = getInventory().getAmount("Feather");
        GroundItem feather = getGroundItems().closest("Feather");
        if(feather != null){
            
            if(!feather.isVisible()) getCamera().toEntity(feather);
            else{
                feather.interact("Take");
                new ConditionalSleep(5000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return getInventory().getAmount("Feather") > featherCount;
                    }
                }.sleep();
            }
        }
        return 750;
    }
}

But that is besides the point. He needs to learn Java xD

 

Yeah, as I said in my reply that I'm not familiar with the API.  And I just rewrote his broken script to work.

Yeah, as I said in my reply that I'm not familiar with the API.  And I just rewrote his broken script to work.

 

You said

 

  Edit: not so familiar with the API yet, let me know if there are better ways lol.

 

So I did :xdoge:

Your code can be simplified / improved to:

import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "FFTL", info = "First", name = "main", version = 1.0, logo = "")
public class FFTLFeathers extends Script {

    @Override
    public int onLoop() throws InterruptedException {
        
        long featherCount = getInventory().getAmount("Feather");
        GroundItem feather = getGroundItems().closest("Feather");
        if(feather != null){
            
            if(!feather.isVisible()) getCamera().toEntity(feather);
            else{
                feather.interact("Take");
                new ConditionalSleep(5000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return getInventory().getAmount("Feather") > featherCount;
                    }
                }.sleep();
            }
        }
        return 750;
    }
}
But that is besides the point. He needs to learn Java xD
I believe default values for turning camera and walking are default for interaction event. You didn't need to check it's visibility

I believe default values for turning camera and walking are default for interaction event. You didn't need to check it's visibility

 

You're right, fixed

 

Does this help you buddy?

@ScriptManifest(author = "FFTL", info = "First", name = "main", version = 1.0, logo = "")
public class FFTLFeathers extends Script {
    private State state;

    public enum State {

        LOOTING, WALKING, FILLTHISINMAN

    }

    @Override
    public int onLoop() throws InterruptedException {
        getState();
        switch (state) {
            case LOOTING:
                lootFeather();
                break;
        }
        return 750;
    }

    private void getState() {
        final GroundItem feather = closestGroundItemForName("Feather");

        if (feather != null) {
            if (feather.isVisible()) {
                state = State.LOOTING;
            }
        }
    }

    public void lootFeather() {
        GroundItem feather = closestGroundItemForName("Feather");
        if (feather != null)
            feather.interact("Take");
    }

    private GroundItem closestGroundItemForName(final String name) {
        final GroundItems groundItems = new GroundItems();
        final List<GroundItem> list = groundItems.filter(new NameFilter<>(name));
        for (GroundItem g : list) {
            if (g.isOnScreen() && g.exists()) { //You could implement a null-check here
                return g;
            }
        }
        return null;
    }
}
Edit: not so familiar with the API yet, let me know if there are better ways lol.
You don't create a GroundItems class like that. You grab it's getter methods from within the method provder.

So script.getGroundItems()

You don't create a GroundItems class like that. You grab it's getter methods from within the method provder.

So script.getGroundItems()

 

Alright, thanks man. No need to call the super btw. Can just do #getGroundItems(). happy.png

Edited by KEVzilla

  • Author

Thanks all who answered and who made better code for me, i got it to working state and will start to tweak it and add stuff such as antiban.smile.png

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.