Jump to content

dunderzutt

Members
  • Posts

    5
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

dunderzutt's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. No that's not the word I was refering to but that doesn't matter. Yeah I think classes is what I meant. In my mind I see it working as I put onpaint things in a paint.class and then call them from the Main file. Is that correct? Thanks for the answers to the other questions! much appreciated.
  2. extending this with another question, how do I customize walkpaths I would rather select my own tiles/area of tiles to let the bot click in. Thanks
  3. I made a thread asking for help yesterday and got the help, i'm unsure if I'm suppose to continue that thread or make a new one so I decided to make a new one. If this was wrong please tell me. So I got two questions. 1. line 62 I get a warning with "getBank().depositAllExcept(axes -> axes.getName().contains(" axe"));" says multiple markers at this line. I can do "@SuppressWarnings("unchecked")" to remove that warning but I would rather see if it's something I need to get fixed and fix it the correct way. How would I do it? 2. I have read about a word I don't remember what it was but it had to do with splitting the script into smaller .java files I think and having like one Main one and then maybe one for Woodcutting, one for banking and one for paint. I have no clue at all how to do this so if someone could link me a tutorial or try to explain this to me I would greatly appreciate that! Thanks for all the help I can get! package core; import java.awt.Color; import java.awt.Graphics2D; //import java.awt.Image; //import java.io.IOException; //import java.net.URL; import java.time.LocalTime; import java.util.concurrent.TimeUnit; //import javax.imageio.ImageIO; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Woodcutting", version = 1.0, author = "HeyImJamie", info = "", logo = "") public class Main extends Script { private long timeBegan; private long timeRan; private int beginningXp; private int currentXp; private int xpGained; private int currentLevel; private int beginningLevel; private int levelsGained; //private final Image bg = getImage("https://i.imgur.com/rgIR2OP.png"); @Override public void onStart() { timeBegan = System.currentTimeMillis(); beginningXp = skills.getExperience(Skill.WOODCUTTING); beginningLevel = skills.getStatic(Skill.WOODCUTTING); } @Override public int onLoop() throws InterruptedException { if (shouldBank()) { bank(); } else { cutTree(getTreeName()); } return 100; } private boolean shouldBank() { return getInventory().isFull(); } @SuppressWarnings("unchecked") private void bank() throws InterruptedException { if (!Banks.DRAYNOR.contains(myPlayer())) { getWalking().webWalk(Banks.DRAYNOR); } else { if (!getBank().isOpen()) { getBank().open(); } else { getBank().depositAllExcept(axes -> axes.getName().contains(" axe")); } } } private void cutTree(String treeName) { if (!getTreeArea().contains(myPlayer())) { getWalking().webWalk(getTreeArea()); } else { RS2Object tree = getObjects().closest(getTreeArea(), getTreeName()); if (!myPlayer().isAnimating() && tree != null) { if (tree.interact("Chop down")) { new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } } } private Area getTreeArea() { if (getSkills().getDynamic(Skill.WOODCUTTING) >= 60) { return new Area(3203, 3506, 3225, 3497); } else { return new Area(3091, 3239, 3076, 3230); } } private String getTreeName() { if (getSkills().getDynamic(Skill.WOODCUTTING) >= 60){ return "Yew"; } else if (getSkills().getDynamic(Skill.WOODCUTTING) >= 30){ return "Willow"; } else if (getSkills().getDynamic(Skill.WOODCUTTING) >= 15){ return "Oak"; } else { return "Tree"; } } @Override public void onPaint(Graphics2D g) { g.setColor(Color.BLACK); //background //g.drawImage(bg, 26, 108, null); //time timeRan = System.currentTimeMillis() - this.timeBegan; g.drawString("Run time: "+ft(timeRan), 390, 400); //xp currentXp = skills.getExperience(Skill.WOODCUTTING); xpGained = currentXp - beginningXp; g.drawString("Gained " + xpGained + " Xp", 390, 380); //levels currentLevel = skills.getStatic(Skill.WOODCUTTING); levelsGained = currentLevel - beginningLevel; g.drawString(beginningLevel + " / " + currentLevel + " ( +" + levelsGained + " )", 390, 360); } private String ft(long duration) { return LocalTime.ofSecondOfDay(TimeUnit.MILLISECONDS.toSeconds(duration)).toString(); } /*private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) {} return null; }*/ }
  4. Script is from HeyImJamie, i'm tryna learn from it. Right now it clicks trees outside the area I selected "(3119, 3221, 3104, 3217);" then it runs back into area and creating a loop of clicking outside area then moving back into area etc etc. Would appreciate any help! thanks! package core; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Free Woodcutter", version = 1.0, author = "HeyImJamie", info = "", logo = "") public class Main extends Script { @Override public int onLoop() throws InterruptedException { if (shouldBank()) { bank(); } else { cutTree(getTreeName()); } return 100; } private boolean shouldBank() { return getInventory().isFull(); } private void bank() throws InterruptedException { if (!Banks.DRAYNOR.contains(myPlayer())) { getWalking().webWalk(Banks.DRAYNOR); } else { if (!getBank().isOpen()) { getBank().open(); } else { getBank().depositAllExcept(axes -> axes.getName().contains(" axe")); } } } private void cutTree(String treeName) { if (!getTreeArea().contains(myPlayer())) { getWalking().webWalk(getTreeArea()); } else { RS2Object tree = getObjects().closest(treeName); if (!myPlayer().isAnimating() && tree != null) { if (tree.interact("Chop down")) { new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } } } private Area getTreeArea() { if (getSkills().getDynamic(Skill.WOODCUTTING) >= 60) { return new Area(3203, 3506, 3225, 3497); } else { return new Area(3119, 3221, 3104, 3217); } } private String getTreeName() { if (getSkills().getDynamic(Skill.WOODCUTTING) >= 60){ return "Yew"; } else if (getSkills().getDynamic(Skill.WOODCUTTING) >= 15){ return "Oak"; } else { return "Tree"; } } }
×
×
  • Create New...