Rhetoric Posted June 20, 2016 Share Posted June 20, 2016 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. Quote Link to comment Share on other sites More sharing options...
Juggles Posted June 20, 2016 Share Posted June 20, 2016 (edited) 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, 2016 by lg_juggles Quote Link to comment Share on other sites More sharing options...
Rhetoric Posted June 20, 2016 Author Share Posted June 20, 2016 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. Quote Link to comment Share on other sites More sharing options...
Token Posted June 20, 2016 Share Posted June 20, 2016 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 2 Quote Link to comment Share on other sites More sharing options...
Juggles Posted June 20, 2016 Share Posted June 20, 2016 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. Quote Link to comment Share on other sites More sharing options...
FrostBug Posted June 20, 2016 Share Posted June 20, 2016 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]); 6 Quote Link to comment Share on other sites More sharing options...
BurritoBug Posted June 20, 2016 Share Posted June 20, 2016 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 Quote Link to comment Share on other sites More sharing options...
Rhetoric Posted June 20, 2016 Author Share Posted June 20, 2016 Thanks for the help guys, I think I got it. Quote Link to comment Share on other sites More sharing options...
Lone Posted June 21, 2016 Share Posted June 21, 2016 Nice to see that you are working it out on your own, if you get stuck feel free to Pm me. Quote Link to comment Share on other sites More sharing options...
Strange_Fk Posted June 23, 2016 Share Posted June 23, 2016 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 Quote Link to comment Share on other sites More sharing options...