Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Make sure you have Java 8 installed
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
Download the DreamBot client today!

jaisuun

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. package scripts.CowKillahPaint; import org.dreambot.api.methods.MethodProvider; import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.listener.PaintListener; import org.dreambot.api.wrappers.items.GroundItem; import java.awt.*; import java.util.concurrent.TimeUnit; @ScriptManifest(category = Category.COMBAT, name = "CowKillahPaint", author = "Jaisuun", version = 1.0, description = "Information overlay for collecting cowhides and killing cows.") public class CowKillahPaint extends AbstractScript implements PaintListener { public static final String COW = "Cow"; public int cowhide = 0; public int cowhidePrice = 140; public int goldEarned = 0; public int strBeginningXP; public int strCurrentXP; public int strXpGained; public int prayXp1; public int prayXp2; public int prayXp3; public long timeBegan; public long timeRan; AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.50F); @Override public void onStart(){ timeBegan = System.currentTimeMillis(); strBeginningXP = getSkills().getExperience(Skill.STRENGTH); prayXp1 = getSkills().getExperience(Skill.PRAYER); } @Override public void onPaint(Graphics g) { timeRan = System.currentTimeMillis() - this.timeBegan; strCurrentXP = getSkills().getExperience(Skill.STRENGTH); prayXp2 = getSkills().getExperience(Skill.PRAYER); strXpGained = strCurrentXP - strBeginningXP; prayXp3 = prayXp2 - prayXp1; goldEarned = cowhide * cowhidePrice; g.setColor(new Color(87, 80, 64)); g.fillRect(4, 275, 160, 60); g.setColor(new Color(204, 187, 154)); g.fillRect(4, 278, 157, 57); g.setColor(Color.black); g.drawString("Runtime: " + ft(timeRan), 8, 288); g.drawString("Strength XP Gained: " + strXpGained, 8, 299); g.drawString("Prayer XP Gained: " + prayXp3, 8, 310); g.drawString("Gold Earned: " + goldEarned, 8, 321); g.drawString("Cowhides: " + cowhide, 8, 332); } private String ft(long duration){ String res = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); if(days == 0) { res = (hours + ":" + minutes + ":" + seconds); } else { res = (days + ":" + hours + ":" + minutes + ":" + seconds); } return res; } @Override public int onLoop() { GroundItem cowhides = getGroundItems().closest("Cowhide"); if(cowhides != null) { MethodProvider.sleepUntil(() -> getInventory().count("Cowhide") > cowhide, 10000); cowhide++; } return 100; } }
  2. So, the title says it all, I am having trouble accurately counting objects interacted with manually, without having the script interact with the item itself. I could just be looking at the logic wrong, and will post my code later this evening.
×
×
  • Create New...