January 2, 201610 yr Hey, just starter botting, and got interested in scripting.Wanted to learn a bit, so made my own script, I already know java, just new to OsBot api. Looking to improve it.Any comment is welcome. Currently only works at yews near GE. I know it could be way more easily maintainable with a node framework, but just wanted to start Would love to get to 75 and maybe get a premmy to see if i can make any Magic Tree script, havent seen any free one. Code import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.ui.Skill; import java.awt.Graphics2D; import java.awt.*; import java.util.concurrent.TimeUnit; import org.osbot.rs07.api.map.Area; @SuppressWarnings("unused") @ScriptManifest(author = "maxibaby", info = "Let's cut some Yews", name = "CocoCutter", version = 0.1, logo = "") public class main extends Script { long timeRan; long timeBegan; int startXP; int currentXP; int GainedXP; int xpPerHour; int logs; final Position BANK_POSITION = new Position(3168,3490,0); final Position YEW_POSITION = new Position(3213,3502,0); final Area YEW_AREA = new Area(3202,3498,3223,3506); public void onStart() { log("Let's get started! today"); this.timeBegan = System.currentTimeMillis(); this.startXP = this.skills.getExperience(Skill.WOODCUTTING); logs = 0; } public int onLoop() throws InterruptedException { if (getSettings().getRunEnergy() > 30 && !getSettings().isRunning()){ getSettings().setRunning(true); sleep(300); } if (!inventory.isFull()){ if (YEW_AREA.contains(myPlayer())){ log("Searching objective"); Entity tree = getObjects().closestThatContains("Yew"); if (tree != null){ if (tree.isVisible()){ if (!myPlayer().isMoving() && !myPlayer().isAnimating()){ tree.interact("Chop Down"); sleep(random(500,800)); } } else { getCamera().toEntity(tree); tree.interact("Chop Down"); sleep(random(500,800)); } } } else { log("Walking to YEW_POSITION"); getLocalWalker().walk(YEW_POSITION,true); } } else { if (!myPosition().equals(BANK_POSITION)){ if (map.distance(BANK_POSITION) <= 5 && map.distance(BANK_POSITION) != 0){ BANK_POSITION.interact(getBot(),"Walk here"); sleep(random(500,800)); } getLocalWalker().walk(BANK_POSITION,true); } else { log("Checking bank"); if (!bank.isOpen()){ NPC banker = getNpcs().closest(5456); banker.interact("Bank"); sleep(random(500,800)); } else { log("depositing"); bank.depositAll(1515); sleep(random(500,800)); bank.close(); } } } return random(200, 300); } public void onExit() { } public static String formatTime(long ms) { long sec = ms / 1000L; return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(sec / 3600L), Long.valueOf((sec % 3600L) / 60L), Long.valueOf(sec % 60L) }); } public void onPaint(Graphics2D g) { g.setColor(Color.WHITE); g.setFont(new Font("Arial", 0, 14)); if (this.currentXP != skills.getExperience(Skill.WOODCUTTING)){ this.currentXP = skills.getExperience(Skill.WOODCUTTING); logs = logs+1; } this.GainedXP = this.currentXP - this.startXP; this.xpPerHour = (int)((double)this.GainedXP / ((double)(System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); this.timeRan = System.currentTimeMillis() - this.timeBegan; g.drawString("Time Ran: " + formatTime(this.timeRan), 15, 295); g.drawString("XP Per hour:" + this.xpPerHour, 15, 315); g.drawString("Logs: " + this.logs + "(" + this.logs * 410 + ")" , 15, 335); } } Download: Link 1) Unzip 2) Put the file into "Home folder/OsBot/Scripts/" 3) Refresh scripts on OsBot Plan: Anti-ban system ? Smart cutting. Keep track to walk to the trees before they spawn. More locations Change world if too many players Get actual price of logs from internet and not a fixed one. Suggestions !? Thanks, @ZappaScripts Edited January 2, 201610 yr by maxibaby
January 3, 201610 yr Author "Not too bad" ? I'm at 1.5m and lv 75, lets see if I make it to the premmy !! :P Will need to change LocalWalker to WebWalker.
January 3, 201610 yr Author What you mean by it doesnt bank, it does. Edited January 3, 201610 yr by maxibaby
January 4, 201610 yr wish i could try it out, dont have an account with 60 woodcutting though and if i were to bot 1-60 woodcutting especially f2p i bet i'd get banned before being able to try it out is your 9 hour bot still going?
January 4, 201610 yr Author I did bot from 45 to 74 and still not banned. At willow I used kCutter i think. Why it doesn't bank? Does he walks to the bank? Can i see a gif or a video? What happens when he gets full? Edited January 4, 201610 yr by maxibaby