Jump to content

bubbajim

Members
  • Posts

    5
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by bubbajim

  1. Hey thanks a lot for the feedback. I really appreciate it. All the comments you made are super informative and i will refactor my script based on them. Ill just go ahead and address this one comment you made: //double webWalking to a position? You could replace this to just webwalking to the bank area. //Also if there are no obstaclesdon't use webwalking, use the normal walk instead as it has better performance I used double webWalking because sometimes it walks by the dark wizards so i figured if i set an intermediate point it will always stick to the Varrock west path. Also i tried using normal walk but it was really buggy for me. It would walk to a tile and just spam click it and not go to the next tile in the path i defined. I'm not sure why this is happening? Maybe i'm using it wrong?
  2. Hi guys. I just got into script making yesterday. I finished my first script today at the request of someone. Its a cadava berry picker that banks. I would appreciate any feedback and constructive criticism. Thank you! import org.osbot.rs07.api.Settings; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; import java.util.concurrent.TimeUnit; @ScriptManifest(name = "Bubba's Berries", author = "bubbajim", version = 1.0, info = "", logo = "") public class BubbasBerries extends Script { private long startTime; private int berriesCounter; private int startWorld = 460; private int endWorld = 451; private int currentWorld = startWorld; private long currentInventoryCapacity = -5; Position pathInBetween = new Position(3290, 3397, 0); Position pathFromBank = new Position(3273, 3370, 0); Position pathToBank = new Position(3252, 3420, 0); Area bankArea = new Area(new Position(3257, 3423, 0), new Position(3250, 3420, 0)); @Override public void onStart() { startTime = System.currentTimeMillis(); } @Override public void onExit() { } @Override public int onLoop() throws InterruptedException { if (getInventory().getAmount(753) == currentInventoryCapacity + 1) { berriesCounter += 1; } currentInventoryCapacity = getInventory().getAmount(753); Settings settings = getSettings(); int runEnergy = settings.getRunEnergy(); if (runEnergy > 50 && !settings.isRunning()) { settings.setRunning(true); } if (getInventory().isFull()) { getWalking().webWalk(pathInBetween); getWalking().webWalk(pathToBank); getBank().open(); sleep(random(1500,2500)); getBank().depositAll(); new ConditionalSleep(10000) { @Override public boolean condition() { return getInventory().isEmpty(); } }.sleep(); } Entity cadavaBush = getObjects().closest(23625, 23626); if (bankArea.contains(myPosition())) { getWalking().webWalk(pathInBetween); getWalking().webWalk(pathFromBank); } else if (cadavaBush != null && cadavaBush.interact("Pick-from")) { int cadavaBushX = cadavaBush.getX(); int cadavaBushY = cadavaBush.getY(); Position cadavaBushPosition = new Position(cadavaBushX, cadavaBushY, 0); if (cadavaBush.getId() == 23625) { new ConditionalSleep(10000) { @Override public boolean condition() { return getObjects().closest(o -> o.getPosition().equals(cadavaBushPosition)).getId() == 23626; } }.sleep(); } else if (cadavaBush.getId() == 23626) { new ConditionalSleep(10000) { @Override public boolean condition() { return getObjects().closest(o -> o.getPosition().equals(cadavaBushPosition)).getId() == 23627; } }.sleep(); } } else { if (endWorld == currentWorld) { currentWorld = startWorld; } currentWorld -= 1; getTabs().open(Tab.LOGOUT); getWorlds().hop(currentWorld); sleep(random(2000,3000)); getTabs().open(Tab.INVENTORY); new ConditionalSleep(10000) { @Override public boolean condition() { return getWorlds().getCurrentWorld() == currentWorld; } }.sleep(); } return random(300, 600); } @Override public void onPaint(Graphics2D g) { final long runTime = (System.currentTimeMillis() - startTime); String hms = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(runTime), TimeUnit.MILLISECONDS.toMinutes(runTime) % TimeUnit.HOURS.toMinutes(1), TimeUnit.MILLISECONDS.toSeconds(runTime) % TimeUnit.MINUTES.toSeconds(1)); Font font = new Font("Open Sans", Font.PLAIN, 12); g.setFont(font); g.setColor(Color.green); g.drawString("Time elapsed: " + hms, 15, 300); g.drawString("Berries picked: " + berriesCounter, 15, 315); } }
×
×
  • Create New...