June 20, 20169 yr 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.
June 20, 20169 yr 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 June 20, 20169 yr by lg_juggles
June 20, 20169 yr 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.
June 20, 20169 yr 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
June 20, 20169 yr 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.
June 20, 20169 yr 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]);
June 20, 20169 yr 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
June 21, 20169 yr Nice to see that you are working it out on your own, if you get stuck feel free to Pm me.
June 23, 20169 yr 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