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.

Change trees according to level

Featured Replies

Hey guys,

 

What's the best way to have my script check if my my wc level is able to cut better trees while already chopping an inferior tree?

 

So if I'm cutting trees and I level up to 15, have it move onto Oaks automatically.

Try something like this. You could continue to add this for each level if you wanted to. Just make a range between two numbers. 

  if (getSkills().getDynamic(Skill.WOODCUTTING) <15) {
                    ChopLogs;
                }
                
                if (getSkills().getDynamic(Skill.WOODCUTTING) >=15 && getSkills().getDynamic(Skill.WOODCUTTING) <30 ) {
                    ChopOaks;
                }

Edited by lg_juggles

  • Author

 

Try something like this. You could continue to add this for each level if you wanted to. Just make a range between two numbers. 

  if (getSkills().getDynamic(Skill.WOODCUTTING) <15) {
                    ChopLogs;
                }
                
                if (getSkills().getDynamic(Skill.WOODCUTTING) >=15 && getSkills().getDynamic(Skill.WOODCUTTING) <30 ) {
                    ChopOaks;
                }

 

I have something very similar to this. Instead of making multiple Chop cases, I wanted to make one that changes a variable that represents the type of tree. The only thing I need to figure out is how to force my case DetermineTree to run when the script starts and again as the script runs.

 

enum Trees { 
    NORMAL(1, new Position(...)), OAK(15, new Position(...)), ... ;

    private int level;
    private Position location;

    TREES(int level, Position location) {
        this.level = level;
        this.location = location;
    }

    public static Trees getCurrent(Script script) {
        int c = script.getStatic(Skill.WOODCUTTING);
        if (c < 15) 
            return Trees.NORMAL;
        else if (c < 30)
            return Trees.OAK;
        else if (c < 45)
            return Trees.WILLOW;
        else if (c < 60)
            return Trees.MAPLE;
        else if (c < 75)
            retirm Trees.YEW;
        else if (c < 90)
            return Trees.MAGIC;
        else
            return Trees.REDWOOD;
    }
}

Trees current;

@Override
public void onStart() {
    current = Trees.getCurrent(this);
    ...
}

@Override
public int onLoop() {
    current = Trees.getCurrent(this);
    ...
    return 69;
}

When you are chopping a tree different from current, then its time to switch

I have something very similar to this. Instead of making multiple Chop cases, I wanted to make one that changes a variable that represents the type of tree. The only thing I need to figure out is how to force my case DetermineTree to run when the script starts and again as the script runs.

 

Like Token said above it'll switch when its at its new level. 


String[] trees = {"Tree", "Oak tree", "Willow tree", "Maple tree", "Yew tree", "Magic tree"};

int level = getSkills().getStatic(Skills.WOODCUTTING);

RS2Object tree = getObjects().closest(trees[level / 15]);

String[] trees = {"Tree", "Oak tree", "Willow tree", "Maple tree", "Yew tree", "Magic tree"};

int level = getSkills().getStatic(Skills.WOODCUTTING);
RS2Object tree = getObjects().closest(trees[level / 15]);

op boge

Nice to see that you are working it out on your own, if you get stuck feel free to Pm me.

String[] trees = {"Tree", "Oak tree", "Willow tree", "Maple tree", "Yew tree", "Magic tree"};

int level = getSkills().getStatic(Skills.WOODCUTTING);
RS2Object tree = getObjects().closest(trees[level / 15]);

Damn thats genius hahahahah

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.