JaggerNotchas Posted July 23, 2023 Share Posted July 23, 2023 How would i go about fixing these errors? help would be much apprecaited! Errors: https://gyazo.com/47644d4e6e865d391b6eb94e8fd3191e Script code import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "WoodcutterScript", author = "Pgreen", version = 1.0, info = "Basic Woodcutting Script", logo = "") public class WoodcutterScript extends Script { private static final Area TREE_AREA = new Area(3163, 3287, 3167, 3290); public class Woodcutter extends Script { private long startTime = System.currentTimeMillis(); private int logsCut = 0; // ... (Existing code) @Override public void onStart() { log("Starting Woodcutter script..."); } @Override public void onExit() { log("Stopping Woodcutter script..."); } @Override public int onLoop() throws InterruptedException { // The onLoop() method contains the main logic of your script // Put the actions you want to repeat here // If we don't have an axe equipped, let's equip one if (!getEquipment().isWearingItem("Bronze axe") && !getInventory().contains("Bronze axe")) { getEquipment().equip("Bronze axe"); return random(1000, 1500); // Wait for the equipment screen to open } // If our inventory is full, let's go to the bank and deposit the logs if (getInventory().isFull()) { getBank().open(); getBank().depositAll("Logs"); getBank().close(); } else { // If we're not in the tree area, let's walk there if (!TREE_AREA.contains(myPlayer())) { getWalking().webWalk(TREE_AREA); } else { // If we're in the tree area, let's cut trees RS2Object tree = getObjects().closest("Tree"); if (tree != null && tree.isVisible()) { tree.interact("Chop down"); sleepUntil(() -> myPlayer().isAnimating() || myPlayer().isMoving(), random(3000, 5000)); sleepUntil(() -> !myPlayer().isAnimating(), random(5000, 8000)); logsCut++; } } } return random(100, 200); // Return a value to set the delay between loops } @Override public void onPaint(Graphics2D g) { // This is where you can add your custom paint // Calculate time spent woodcutting long timeElapsed = System.currentTimeMillis() - startTime; String timeFormatted = formatTime(timeElapsed); // Get woodcutting level int woodcuttingLevel = getSkills().getStatic(Skill.WOODCUTTING); // Draw the custom paint g.setColor(Color.BLACK); g.fillRect(10, 10, 180, 75); g.setColor(Color.WHITE); g.drawRect(10, 10, 180, 75); g.setFont(new Font("Arial", Font.PLAIN, 14)); g.drawString("Woodcutting Level: " + woodcuttingLevel, 15, 30); g.drawString("Logs Cut: " + logsCut, 15, 50); g.drawString("Time Running: " + timeFormatted, 15, 70); } private String formatTime(long time) { long seconds = time / 1000; long minutes = seconds / 60; long hours = minutes / 60; long days = hours / 24; return String.format("%02d:%02d:%02d:%02d", days, hours % 24, minutes % 60, seconds % 60); } // ... (Existing code) } } Quote Link to comment Share on other sites More sharing options...
Gunman Posted July 23, 2023 Share Posted July 23, 2023 @JaggerNotchas Why do you have a class that extends script inside another class that extends script? And the error is complaining because the main class doesn't override onloop like your inner one does. Just remove that inner class and move all the methods to the main class 1 1 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted July 23, 2023 Share Posted July 23, 2023 Remove this line and a } at the bottom public class Woodcutter extends Script { Quote Link to comment Share on other sites More sharing options...
JaggerNotchas Posted July 25, 2023 Author Share Posted July 25, 2023 (edited) i fixed it kinda but still throwing these errors: https://gyazo.com/3e92e2cb80ac5a01ba05135fab31a4f8 import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "WoodcutterScript", author = "Pgreen", version = 1.0, info = "Basic Woodcutting Script", logo = "") public class WoodcutterScript extends Script { private long startTime = System.currentTimeMillis(); private int logsCut = 0; private static final Area TREE_AREA = new Area(3163, 3287, 3167, 3290); @Override public void onStart() { log("Starting Woodcutter script..."); } @Override public void onExit() { log("Stopping Woodcutter script..."); } @Override public int onLoop() throws InterruptedException { // The onLoop() method contains the main logic of your script // Put the actions you want to repeat here // If we don't have an axe equipped, let's equip one if (!getEquipment().isWearingItem("Bronze axe") && !getInventory().contains("Bronze axe")) { getEquipment().equip("Bronze axe"); return random(1000, 1500); // Wait for the equipment screen to open } // If our inventory is full, let's go to the bank and deposit the logs if (getInventory().isFull()) { getBank().open(); getBank().depositAll("Logs"); getBank().close(); } else { // If we're not in the tree area, let's walk there if (!TREE_AREA.contains(myPlayer())) { getWalking().webWalk(TREE_AREA); } else { // If we're in the tree area, let's cut trees RS2Object tree = getObjects().closest("Tree"); if (tree != null && tree.isVisible()) { tree.interact("Chop down"); sleepUntil(() -> myPlayer().isAnimating() || myPlayer().isMoving(), random(3000, 5000)); sleepUntil(() -> !myPlayer().isAnimating(), random(5000, 8000)); logsCut++; } } } return random(100, 200); // Return a value to set the delay between loops } @Override public void onPaint(Graphics2D g) { // This is where you can add your custom paint // Calculate time spent woodcutting long timeElapsed = System.currentTimeMillis() - startTime; String timeFormatted = formatTime(timeElapsed); // Get woodcutting level int woodcuttingLevel = getSkills().getStatic(Skill.WOODCUTTING); // Draw the custom paint g.setColor(Color.BLACK); g.fillRect(10, 10, 180, 75); g.setColor(Color.WHITE); g.drawRect(10, 10, 180, 75); g.setFont(new Font("Arial", Font.PLAIN, 14)); g.drawString("Woodcutting Level: " + woodcuttingLevel, 15, 30); g.drawString("Logs Cut: " + logsCut, 15, 50); g.drawString("Time Running: " + timeFormatted, 15, 70); } private String formatTime(long time) { long seconds = time / 1000; long minutes = seconds / 60; long hours = minutes / 60; long days = hours / 24; return String.format("%02d:%02d:%02d:%02d", days, hours % 24, minutes % 60, seconds % 60); } // ... (Existing code) } Edited July 25, 2023 by JaggerNotchas Quote Link to comment Share on other sites More sharing options...
sleepbotsbot Posted July 30, 2023 Share Posted July 30, 2023 Make sure you're using the correct methods and that the input matches the input type. You can't call getEquipment().isWearingItem("Bronze axe") because there isn't a method that expects a String as its first and only input. Similarly equipment.equip() doesn't expect a String as its only input. Quote Link to comment Share on other sites More sharing options...