![](https://osbot.org/forum/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
![](https://osbot.org/forum/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_default_photo.png)
skylar15100
Members-
Posts
3 -
Joined
-
Last visited
-
Feedback
0%
Profile Information
-
Gender
Male
skylar15100's Achievements
![Rank: Newbie (1/10) Newbie](https://osbot.org/forum/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_default_rank.png)
Newbie (1/10)
0
Reputation
-
Thank you for the help, sorry i've seen code tags used on other posts but i couldn't out how to use them.
-
player moves to tree area but gets stuck in state "Finding Tree". import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.input.mouse.MouseDestination; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @SuppressWarnings("unused") @ScriptManifest(author = "CloudCode", info = "Simple Treecutting script", name = "Logger", version = 1, logo = "") public class Main extends Script { private long timeStart; private String state = "Initializing.."; private int invCount = 0; private int LogsChopped = 0; private int lastMA = 0; Area westBank = new Area( new Position(3167,3414,0), new Position(3184,3435,0)); Area VarrockOak = new Area( new Position(3185, 3436, 0), new Position(3168, 3418, 0)); @Override public void onStart() { log("Welcome to 'Logger' by CloudCode"); log("Submit any Errors to me on the forums and i'd be happy to take a look."); timeStart = System.currentTimeMillis(); getExperienceTracker().start(Skill.WOODCUTTING); } @Override public void onPaint(Graphics2D g) { long timeElapsed = System.currentTimeMillis() - timeStart; long seconds = (timeElapsed / 1000) % 60; long minutes = (timeElapsed / (1000 * 60)) % 60; long hours = (timeElapsed / (1000 * 60 * 60)) % 24; g.setFont(new Font("Trebuchet MS", Font.PLAIN, 14)); g.setColor(Color.white); g.drawString("x", (int)getMouse().getPosition().getX() - 4, (int)getMouse().getPosition().getY() + 5); g.drawString(state, 8, 50); g.drawString("Time Running: " + (hours >= 10 ? "" + hours : "0" + hours) + ":" + (minutes >= 10 ? "" + minutes : "0" + minutes) + ":" + (seconds >= 10 ? "" + seconds : "0" + seconds), 8, 65); g.drawString("XP Gained: " + getExperienceTracker().getGainedXP(Skill.WOODCUTTING) + " (" + getExperienceTracker().getGainedLevels(Skill.WOODCUTTING) + ")", 8, 80); g.drawString("Logs Chopped " + LogsChopped, 8, 95); } private void randomizeMouse() { lastMA++; if (lastMA > 4) { int i = random(5); switch (i) { case 0: case 1: getMouse().moveOutsideScreen(); break; case 2: getMouse().moveRandomly(); break; case 3: getMouse().moveSlightly(); lastMA = 3; break; case 4: getMouse().moveVerySlightly(); break; case 5: getTabs().open(randomTab()); if (getTabs().getOpen() == Tab.SKILLS) { getMouse().move(704, 283); } } lastMA = 0; } } private Tab randomTab() { int i = random(6); switch(i) { case 0: case 1: return Tab.INVENTORY; case 2: return Tab.EQUIPMENT; case 3: return Tab.ATTACK; case 4: return Tab.SKILLS; case 5: return Tab.FRIENDS; case 6: return Tab.QUEST; } return Tab.SKILLS; } @Override public int onLoop() throws InterruptedException { if (getInventory().isFull() && !westBank.contains(myPlayer()) && !getBank().isOpen()) { state = "Banking..."; getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition())); } if (getInventory().isFull() && westBank.contains(myPlayer()) && !getBank().isOpen()) { RS2Object bank = getObjects().closest("Bank booth"); state = "Opening bank"; if (bank != null) { if (bank.interact("Bank")) { state = "Depositing items"; sleep(1000); } } } if (getInventory().isFull() && westBank.contains(myPlayer()) && getBank().isOpen()) { getBank().depositAllExcept("Axe"); while (getInventory().contains("Logs, Oak Logs, Yew Logs")) { sleep(100); } state = "Closing bank"; getBank().close(); } if (!getInventory().isFull() && !VarrockOak.contains(myPlayer()) && !getBank().isOpen() ) { state = "Walking to Oak Trees"; getWalking().webWalk(new Position(3168 + random(3), 3418 + random(3), 0)); } if (!getInventory().isFull() && VarrockOak.contains(myPlayer())) { NPC spot = getNpcs().closest("Oak"); state = "Finding Tree"; Entity tree = getObjects().closestThatContains("Oak"); if (tree != null){ if (tree.isVisible()){ if (!myPlayer().isMoving() && !myPlayer().isAnimating()){ tree.interact("Chop Down"); sleep(random(500,800)); } } } } while (myPlayer().isAnimating()) { state = "Chopping Tree.."; randomizeMouse(); if (getInventory().getEmptySlots() != invCount && VarrockOak.contains(myPlayer())) { invCount = getInventory().getEmptySlots(); LogsChopped += 1; } sleep(random (500, 1000)); } return random(200, 300); } @Override public void onExit() { } }
-
I'd really like to test this script out if at all possible.