RSMasterGuard 19 Share Posted June 8, 2022 On 6/6/2022 at 1:40 PM, nsfwolive said: Which useful methods should I know, to begin coding? eg: Am I currently mining? Are there any available copper veins nearby? Mine the nearest available copper vein Is my inventory full? Does my inventory contain a specified item? Does my inventory contain more tin than copper? Walk from veins to the nearest smelter Use copper ore on smelter Check my smithing level When I used a bronze bar on an anvil, how do I select a specific item to craft? How do I sell an item at the general store? Use a knife on a log Select what to fletch You will want to read the Javadocs as there are already prewritten method for each of those in their own subsections such as Inventory. For currently mining I like to use isAnimating and for game objects you can use GameObject. Honestly if the Javadoc doesn't work for you then go into the local script section and look at the open source and source code that people post in there and reverse engineer what you are looking to do. i have a program in the local scripts that has some of these values. Link to comment Share on other sites More sharing options...
420x69x420 72 Share Posted June 15, 2022 On 6/6/2022 at 3:40 PM, nsfwolive said: Which useful methods should I know, to begin coding? Am I currently mining? (comparison boolean) Players.localPlayer().getAnimation != -1 Or, enable Developer Tools in Dreambot client settings, and check player animation while mining, and say Players.localPlayer().getAnimation == <mining animation ID> Are there any available copper veins nearby? Filter<GameObject> f = (potentialCopper -> potentialCopper.getID == <non-depleted copper vein ID> && potentialCopper.distance() <= 8); GameObject copper = GameObjects.closest(f); if(copper != null) { //here you can write code knowing there is a nearby copper ore within 8 tiles of your character } Mine the nearest available copper vein copper.interact("Mine"); Is my inventory full? Inventory.isFull() Does my inventory contain a specified item? Inventory.contains("Bronze dagger") Inventory.contains(512) Does my inventory contain more tin than copper? int tinQty = Inventory.count("Tin"); int copperQty = Inventory.count("Copper"); if(tinQty > copperQty) { //more tin than copper } if(copperQty > tinQty) { //more copper than tin } if(copperQty == tinQty) { //equal copper and tin } Walk from veins to the nearest smelter //For this you must go to all smelters you want beforehand to make a list of their locations List<Tile> smelterLocations = new ArrayList<Tile>(); smelterLocations.add(new Tile(x1,y1,z)); smelterLocations.add(new Tile(x2,y2,z)); smelterLocations.add(new Tile(x3,y3,z)); double closestDistance = Players.localPlayer().distance(smelterLocations.get(0)); Tile closestSmelterTile = null; for(Tile smelterTile : smelterLocations) { if(Players.localPlayer().distance(smelterTile) < closestDistance) { closestSmelterTile = smelterTile; closestDistance = Players.localPlayer().distance(smelterTile); } } if(closestDistance <= 8) { //here you can write code knowing you are within 8 tiles of a smelter } if(closestDistance > 8) { if(Walking.shouldWalk() && Walking.walk(closestSmelterTile)) { MethodProvider.sleep(500,1000); } } Use copper ore on smelter Item copper = Inventory.get("Copper"); Filter<GameObject> f = (smelter -> smelter.getName().contains("Smelter lol")) GameObject smelter = GameObjects.closest(f); if(copper != null && smelter != null && copper.useOn(smelter)) { MethodProvider.sleep(500,1000); } Check my smithing level int smithingLvl = Skills.getRealLevel(Skill.SMITHING); When I used a bronze bar on an anvil, how do I select a specific item to craft? if(Smithing.canMake("Bronze dagger") && Smithing.makeAll("Bronze dagger")) { MethodProvider.sleep(500,1000); } How do I sell an item at the general store? if(Shop.isOpen()) { if(Shop.isFull()) { //here you can either worldhop or wait because shop is full } else { Shop.sell("Item", <qty>); } } Use a knife on a log Item knife = Inventory.get("Knife"); Item log = Inventory.get("Log"); if(knife != null && log != null && knife.useOn(log)) { MethodProvider.sleep(500,1000); } Select what to fletch if(ItemProcessing.isOpen()) { if(Skills.getRealLevel(Skill.FLETCHING) >= 5) { ItemProcessing.makeAll("Shortbow"); } else { ItemProcessing.makeAll("Arrow shafts"); } } Link to comment Share on other sites More sharing options...
camelCase 230 Share Posted June 15, 2022 1 hour ago, 420x69x420 said: potentialCopper -> potentialCopper.getID == <non-depleted copper vein ID> you'd probably be better checking model colour instead of having a long list of all the copper vein ids 1 hour ago, 420x69x420 said: List<Tile> smelterLocations = new ArrayList<Tile>(); smelterLocations.add(new Tile(x1,y1,z)); smelterLocations.add(new Tile(x2,y2,z)); smelterLocations.add(new Tile(x3,y3,z)); double closestDistance = Players.localPlayer().distance(smelterLocations.get(0)); Tile closestSmelterTile = null; for(Tile smelterTile : smelterLocations) { if(Players.localPlayer().distance(smelterTile) < closestDistance) { closestSmelterTile = smelterTile; closestDistance = Players.localPlayer().distance(smelterTile); } } smelterLocations.sort(Comparator.comparingDouble(Players.localPlayer()::distance)); cleaner than for loop 1 hour ago, 420x69x420 said: Filter<GameObject> f = (smelter -> smelter.getName().contains("Smelter lol")) GameObject smelter = GameObjects.closest(f); why is this a filter? nice post though Link to comment Share on other sites More sharing options...
420x69x420 72 Share Posted June 16, 2022 14 hours ago, camalCase said: you'd probably be better checking model colour instead of having a long list of all the copper vein ids smelterLocations.sort(Comparator.comparingDouble(Players.localPlayer()::distance)); cleaner than for loop why is this a filter? nice post though u right on all those lol Link to comment Share on other sites More sharing options...
CIeetZ 2 Share Posted June 19, 2022 I ran Your tea thiever for 8 seconds and got perm banned olol jk bro thanks for the guide . G O A T Link to comment Share on other sites More sharing options...
mrbankseed 0 Share Posted March 4, 2023 import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.input.Mouse; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.Category; import org.dreambot.api.utilities.Timer; import org.dreambot.api.wrappers.interactive.GameObject; @ScriptManifest(author = "You", name = "Improved Tea Thiever", version = 1.0, description = "Advanced Tea Thieving Script", category = Category.THIEVING) public class Main extends AbstractScript { private static final int MIN_WAIT = 300; private static final int MAX_WAIT = 800; private static final int MOUSE_MOVE_RANGE = 20; private static final int LOOT_THRESHOLD = 100; private Timer antiBanTimer = new Timer(); private boolean antiBanActive = false; public void onStart() { log("Welcome to Improved Tea Thiever by Apaec."); log("If you experience any issues while running this script please report them to me on the forums."); log("Enjoy the script, gain some thieving levels!."); } private enum State { STEAL, DROP, WAIT }; private State getState() { GameObject stall = getGameObjects().getClosest("Tea stall"); if (!getInventory().isEmpty()) return State.DROP; if (stall != null) return State.STEAL; return State.WAIT; } public void onExit() { } @Override public int onLoop() { switch (getState()) { case STEAL: GameObject stall = getGameObjects().getClosest("Tea stall"); if (stall != null) { if (antiBanActive) { if (antiBanTimer.elapsed() >= MIN_WAIT) { Mouse.moveRandomly(MOUSE_MOVE_RANGE); antiBanTimer.reset(); } } else { stall.interact("Steal-from"); antiBanTimer.reset(); antiBanActive = true; } } break; case DROP: getInventory().getItems(item -> item.getName().equals("Cup of tea") && item.getValue() <= LOOT_THRESHOLD).forEach(item -> item.interact("Drop")); break; case WAIT: sleep(Calculations.random(MIN_WAIT, MAX_WAIT)); antiBanActive = false; break; } return Calculations.random(500, 600); } } Link to comment Share on other sites More sharing options...
AHHEUS 2 Share Posted April 19, 2023 (edited) nvm Edited April 19, 2023 by AHHEUS im dumb Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now