Everything posted by bubbajim
-
First Script Feedback
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?
-
Accepting Script Requests (FREE)
Thanks a lot for the feedback. I didn't know you could do that with walking. And I will separate those things into their own functions. You're right, its much easier to debug and much cleaner to read.
-
First Script Feedback
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); } }
-
Accepting Script Requests (FREE)
Thanks for the idea. I've finished everything except the GE part. Basically you start the script either in the bush area or Varrock west bank and it will go to the berries (avoiding the wizards) and pick what ever is available. Once its finished picking it hops to the next world and picks from there (cycling through world 460 to 451). Its very basic and doesn't have very many fail safes so i think its a little fragile at this point. Despite that, it seems to be running pretty good so far. The biggest challenge i faced was picking the berries and using the conditional sleep. When you pick the berry the id of the entity changes, so i had it wait for the id to change of the current bush you were picking. I would really appreciate any feedback you have. Thanks. 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); } } BubbasBerries.java
-
Accepting Script Requests (FREE)
I'm new and want to learn. If you have any simple script ideas or a want a simple personalized script i'll be willing to make it for free.