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.

Help with enums

Featured Replies

Hi!

am making a progressive miner.. but can't figure out the enums.

 

Got this so far:

Quote

 

    @Override
    public boolean canProcess() {
        return api.skills.getStatic(Skill.MINING) < 15 && !(api.skills.getStatic(Skill.MINING) > 15) && !api.myPlayer().isAnimating() && !api.myPlayer().isMoving() && !api.getInventory().isFull() && proMiner.lumbridgeRocks.contains(api.myPlayer());
    }

    @Override
    public void process(){
        if (Rock.TIN != null)
            api.getObjects().closest("Rock").interact("Mine");

 

and the main class where enums are shown as

Quote

 

public RS2Object tinRock = getRockWithOre(Rock.TIN);
    ArrayList<Task> tasks = new ArrayList<Task>();
    public enum Rock {
        
        CLAY(6705),
        COPPER(4645),
        TIN(53),
        IRON(2576),
        SILVER(74),
        COAL(10508),
        GOLD(8885),
        MITHRIL(-22239),
        ADAMANTITE(21662),
        RUNITE(-31437);
    
        final short COLOUR;
    
        Rock(final int COLOUR) {
    
            this.COLOUR = (short) COLOUR;
        }
    }
    @SuppressWarnings("unchecked")
    public RS2Object getRockWithOre(Rock rock){

        return getObjects().closest(obj -> {

            short[] colours = obj.getDefinition().getModifiedModelColors();

            if(colours != null){

                for(short c : colours){

                    if(c == rock.COLOUR) return true;
                }
            }
            return false;
        });
    }

 

How should I get it to either mine tin or copper? As currently code isn't finished but can't workout it using RS2Object?

 

Thanks

Just now, Montana of 300 said:

 public RS2Object getRockWithOre(Rock rock){

        return getObjects().closest(obj -> {

            short[] colours = obj.getDefinition().getModifiedModelColors();

            if(colours != null){

                for(short c : colours){

                    if(c == rock.COLOUR) return true;
                }
            }
            return false;
        });

You already have that method

  public RS2Object getRockWithOre(Rock rock){

        return getObjects().closest(obj -> {

            short[] colours = obj.getDefinition().getModifiedModelColors();

            if(colours != null){

                for(short c : colours){

                    if(c == rock.COLOUR) return true;
                }
            }
            return false;
        });

Use it as:

getRockWithOre(Rock.TIN);

  • Author

I also haven't classed @getRockWithOre properly.. how should I do this?

 

public RS2Object tinRock = getRockWithOre(Rock.TIN);

That atm?

Paste this in the Task:

public RS2Object tinRock = getRockWithOre(Rock.TIN);
if(tinRock != null){
}

 

1 minute ago, Montana of 300 said:

I also haven't classed @getRockWithOre properly.. how should I do this?

 

public RS2Object tinRock = getRockWithOre(Rock.TIN);

That atm?

Please refer to the post i made before this and let me know if any problems.

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.