Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

KyleGoertzen

Registered
  • Content count

    20
  • Joined

  • Last visited

  • Feedback

    0%

Community Reputation

1 Neutral

About KyleGoertzen

  • Rank
    New Botter

Recent Profile Visitors

218 profile views
  1. What I have here is not a bad start. It's from tutorials on this website. I understand some of java already, classes variables objects methods. But your right I should probably learn more about java.
  2. A big thank you to you you have given me a lot to work with Good idea I will implement that, thank you! Ok great! Thanks a lot
  3. package scripts; import org.tribot.api.General; import org.tribot.api.input.Mouse; import org.tribot.api2007.*; import org.tribot.api2007.types.RSGroundItem; import org.tribot.api2007.types.RSItem; import org.tribot.api2007.types.RSNPC; import org.tribot.api2007.types.RSTile; import org.tribot.script.Script; import org.tribot.script.ScriptManifest; @ScriptManifest(name = "Green dragon bot", category = "Combat", authors = "Kyle", description = "Kills green dragons") public class GreenDragons extends Script { private int[] DRAGON_ID ={1724,1723}; private int HIDES_ID = 314; private int BONES_ID = 1; private int lobsterID = 1; private boolean isRunning = false; private RSTile START_TILE; private boolean shouldBank = true; @Override public void run() { startScript(); if(!isRunning){ isRunning = true; } while(isRunning){ if(Skills.getCurrentLevel(Skills.SKILLS.HITPOINTS) <= 40){ RSItem[] lobsterEat = Inventory.find(lobsterID); if(lobsterEat.length > 0){ lobsterEat[0].click("Eat"); } } RSItem[] lobsterEat = Inventory.find(lobsterID); if(lobsterEat.length < 2){ bank(START_TILE); } if(hidesValid()&&!Player.getRSPlayer().isInCombat()){ pickUpHides(); } if(bonesValid()&&!Player.getRSPlayer().isInCombat()){ pickUpBones(); } if(!hidesValid()&&!bonesValid()&&!Player.getRSPlayer().isInCombat()) { fightDragons(); } } } private void bank(RSTile startTile) { if(WebWalking.walkToBank()){ if(Banking.openBank()){ Banking.depositAll(); Banking.withdraw(20, lobsterID); Banking.close(); WebWalking.walkTo(startTile); } } } private void startScript() { Mouse.setSpeed(170); START_TILE = Player.getPosition(); } private void fightDragons() { RSNPC[] dragon = NPCs.findNearest(DRAGON_ID); if(dragon.length>0&&!dragon[0].isInCombat()){ dragon[0].click(); General.sleep(2000,3000); } } private void pickUpHides() { RSGroundItem[] hides = GroundItems.findNearest(HIDES_ID); if(hides.length>0){ hides[0].click("Take"); General.sleep(1000,2000); } } private void pickUpBones(){ RSGroundItem[] bones = GroundItems.findNearest(BONES_ID); if(bones.length>0){ bones[0].click("Take"); General.sleep(1000,2000); } } private boolean hidesValid() { RSGroundItem[] hides = GroundItems.findNearest(HIDES_ID); if(hides!=null&&hides.length>0){ if(hides[0]!=null){ return true; } else { return false; } } return false; } private boolean bonesValid() { RSGroundItem[] bones = GroundItems.findNearest(BONES_ID); if(bones!=null&&bones.length>0){ if(bones[0]!=null){ return true; } else { return false; } } return false; } }
  4. Thank you so much it works
  5. Thank you, you are a genius
  6. I am so confused why is this happening?? line 79 is if(nearestTree.isOnScreen()) what is null about that? [10:10:12] java.lang.NullPointerException [10:10:12] at scripts.TestWoodCutter.run(TestWoodCutter.java:33) [10:10:12] at scripts.TestWoodCutter.loop(TestWoodCutter.java:45) [10:10:12] at scripts.TestWoodCutter.chopWood(TestWoodCutter.java:79) package scripts; import org.tribot.api.input.Mouse; import org.tribot.api2007.*; import org.tribot.api2007.types.RSObject; import org.tribot.api2007.types.RSTile; import org.tribot.script.Script; import org.tribot.script.ScriptManifest; @ScriptManifest(authors = {"Kyle"}, name = "Test WoodCutter", category = "Woodcutting") public class TestWoodCutter extends Script { private final int TREE_ID = 7419; private final int CUTTING_ANIM = 867; private final int LOG_ID = 1515; private final int AXE_ID = 1359; private RSTile START_TILE; private RSObject[] trees; private RSObject nearestTree; private boolean shouldBank = true; private RSTile mapTile = new RSTile(3303,3470,0); private RSTile mapTile1 = new RSTile(3303,3470,0); private RSTile mapTile2 = new RSTile(3303,3470,0); private boolean check1 = true; private boolean check2 = false; @Override public void run() { startScript(); while (loop()){ } } private boolean loop(){ if(Inventory.isFull() && shouldBank){ bank(START_TILE); } else if(Inventory.isFull() && !shouldBank){ dropWood(); } else { chopWood(); } return true; } private void bank(RSTile startTile) { if(WebWalking.walkToBank()){ if(Banking.openBank()){ Banking.depositAllExcept(AXE_ID); Banking.close(); WebWalking.walkTo(startTile); } } } private void startScript() { Mouse.setSpeed(170); START_TILE = Player.getPosition(); } private void chopWood() { // we are finding the nearest tree with the id given trees = Objects.findNearest(25, TREE_ID); //setting nearest tree to the closest object which is the first object in the array if(trees.length > 0) { nearestTree = trees[0]; } // if the player is not cutting or not moving do stuf if(Player.getAnimation() != CUTTING_ANIM && !Player.isMoving()) { //if the tree is on screen click the model if (nearestTree.isOnScreen()) { Mouse.click(nearestTree.getModel().getTriangles()[0].getBounds().getLocation(),1); //walk to the tree then click the model when it is on the tree } else { // turn the camera towards the tree while walking or whatever Camera.turnToTile(nearestTree.getPosition()); Walking.walkTo(nearestTree.getPosition()); } } } private void dropWood() { Inventory.drop(LOG_ID); } }
  7. Hello, this script runs perfectly except for when the tree is cut down it immediately spam clicks the tree stump until the next one spawns, it is not supposed to do this. Does anyone know why this happens. I believe the error is in the chopwood method but it doesn't make sense why it is happening. I'm really frustrated package scripts; import org.tribot.api.input.Mouse; import org.tribot.api2007.*; import org.tribot.api2007.types.RSObject; import org.tribot.api2007.types.RSTile; import org.tribot.script.Script; import org.tribot.script.ScriptManifest; /** * Created by Andrea on 3/9/2016. */ @ScriptManifest(authors = {"Kyle"}, name = "Test WoodCutter", category = "Woodcutting") public class TestWoodCutter extends Script { private final int TREE_ID = 7419; private final int CUTTING_ANIM = 867; private final int LOG_ID = 1515; private final int AXE_ID = 1359; private RSTile START_TILE; private RSObject[] trees; private RSObject nearestTree; private boolean shouldBank = true; private RSTile mapTile = new RSTile(3303,3470,0); private RSTile mapTile1 = new RSTile(3269,3472,0); private RSTile mapTile2 = new RSTile(3267,3492,0); private boolean check1 = true; private boolean check2 = false; @Override public void run() { startScript(); while (loop()){ } } private boolean loop(){ if(Inventory.isFull() && shouldBank){ bank(START_TILE); } else if(Inventory.isFull() && !shouldBank){ dropWood(); } else { chopWood(); } return true; } private void bank(RSTile startTile) { if(WebWalking.walkToBank()){ if(Banking.openBank()){ Banking.depositAllExcept(AXE_ID); Banking.close(); WebWalking.walkTo(startTile); } } } private void startScript() { Mouse.setSpeed(170); START_TILE = Player.getPosition(); } private void chopWood() { // we are finding the nearest tree with the id given trees = Objects.findNearest(25, TREE_ID); //setting nearest tree to the closest object which is the first object in the array if(trees.length > 0) { nearestTree = trees[0]; } // if the player is not cutting or not moving do stuf if(Player.getAnimation() != CUTTING_ANIM && !Player.isMoving()) { //if the tree is on screen click the model if (nearestTree.isOnScreen()) { Mouse.click(nearestTree.getModel().getTriangles()[0].getBounds().getLocation(),1); //walk to the tree then click the model when it is on the tree } else { // turn the camera towards the tree while walking or whatever Camera.turnToTile(nearestTree.getPosition()); Walking.walkTo(nearestTree.getPosition()); } } } private void dropWood() { Inventory.drop(LOG_ID); } }
  8. Thanks you guys have been a great help!!!
  9. I tried googling it but I can't find any answers to my specific question
  10. How do I use the method WebWalking.walkTo() to go to a certain tile. I could use WebWalking.walkTo(Player.getposition()); and that would be fine except I want to go to a different position, like a coordinate. I can't pass in coordinates in the walkTo() method like this walkTo(3453,3232); Does anyone know how I could make my player walk to a position or tile?
  11. Thank you kindly. Ill implement that into my code now. You are a life saver!
  12. the errors that I'm getting are [16:15:22] Script Started: Test WoodCutter. [16:17:42] java.lang.ArrayIndexOutOfBoundsException: 0 [16:17:42] at scripts.TestWoodCutter.chopWood(TestWoodCutter.java:66) [16:17:42] at scripts.TestWoodCutter.loop(TestWoodCutter.java:40) [16:17:42] at scripts.TestWoodCutter.run(TestWoodCutter.java:28) [16:17:42] at java.lang.Thread.run(Thread.java:745) [16:17:42] Script Ended: Test WoodCutter. I'm assuming this means that there is an arrayindexoutofboundsexception in the chopwood method but I don't understand where I'm out of bounds..... If anyone could guide me to an answer I would greatly appreciate it package scripts; import org.tribot.api.input.Mouse; import org.tribot.api2007.*; import org.tribot.api2007.types.RSObject; import org.tribot.api2007.types.RSTile; import org.tribot.script.Script; import org.tribot.script.ScriptManifest; /** * Created by Andrea on 3/9/2016. */ @ScriptManifest(authors = {"Kyle"}, name = "Test WoodCutter", category = "Woodcutting") public class TestWoodCutter extends Script { private final int TREE_ID = 7419; private final int CUTTING_ANIM = 867; private final int LOG_ID = 1515; private final int AXE_ID = 1359; private RSTile START_TILE; private RSObject[] trees; private RSObject nearestTree; private boolean shouldBank = true; @Override public void run() { startScript(); while (loop()){ } } private boolean loop(){ if(Inventory.isFull() && shouldBank){ bank(START_TILE); } else if(Inventory.isFull() && !shouldBank){ dropWood(); } else { chopWood(); } return true; } private void bank(RSTile startTile) { if(WebWalking.walkToBank()){ if(Banking.openBank()){ Banking.depositAllExcept(AXE_ID); Banking.close(); WebWalking.walkTo(startTile); } } } private void startScript() { Mouse.setSpeed(170); START_TILE = Player.getPosition(); } private void chopWood() { // we are finding the nearest tree with the id given trees = Objects.findNearest(25, TREE_ID); //setting nearest tree to the closest object which is the first object in the array nearestTree = trees[0]; // if the player is not cutting or not moving do stuf if(Player.getAnimation() != CUTTING_ANIM && !Player.isMoving()) { //if the tree is on screen click the model if (nearestTree.isOnScreen()) { Mouse.click(nearestTree.getModel().getTriangles()[0].getBounds().getLocation(),1); //walk to the tree then click the model when it is on the tree } else { // turn the camera towards the tree while walking or whatever Camera.turnToTile(nearestTree.getPosition()); Walking.walkTo(nearestTree.getPosition()); } } } private void dropWood() { Inventory.drop(LOG_ID); } }
  13. How can I detect objects outside of the loaded region
  14. It will find a yew tree if im close to it but it wont go to a yew tree thats is definitely within 10000 tiles away
  15. In the chopWood method i have an RSObject array called trees that finds the nearest tree within 10000 of a tree of a certain id. When I run the script it wont find yew trees near it even though I have it set to 10000. Does anyone know why? package scripts; import org.tribot.api.input.Mouse; import org.tribot.api2007.*; import org.tribot.api2007.types.RSObject; import org.tribot.api2007.types.RSTile; import org.tribot.script.Script; import org.tribot.script.ScriptManifest; /** * Created by Andrea on 3/9/2016. */ @ScriptManifest(authors = {"Kyle"}, name = "Test WoodCutter", category = "Woodcutting") public class TestWoodCutter extends Script { private final int TREE_ID = 7419; private final int CUTTING_ANIM = 867; private final int LOG_ID = 1515; private final int AXE_ID = 1359; private RSTile START_TILE; private RSObject[] trees; private RSObject nearestTree; private boolean shouldBank = true; @Override public void run() { startScript(); while (loop()){ } } private boolean loop(){ if(Inventory.isFull() && shouldBank){ bank(START_TILE); } else if(Inventory.isFull() && !shouldBank){ dropWood(); } else { chopWood(); } return true; } private void bank(RSTile startTile) { if(WebWalking.walkToBank()){ if(Banking.openBank()){ Banking.depositAllExcept(AXE_ID); Banking.close(); WebWalking.walkTo(startTile); } } } private void startScript() { Mouse.setSpeed(170); START_TILE = Player.getPosition(); } private void chopWood() { // we are finding the nearest tree with the id given trees = Objects.findNearest(10000, TREE_ID); //setting nearest tree to the closest object which is the first object in the array nearestTree = trees[0]; // if the player is not cutting or not moving do stuf if(Player.getAnimation() != CUTTING_ANIM && !Player.isMoving()) { //if the tree is on screen click the model if (nearestTree.isOnScreen()) { Mouse.click(nearestTree.getModel().getTriangles()[0].getBounds().getLocation(),1); //walk to the tree then click the model when it is on the tree } else { // turn the camera towards the tree while walking or whatever Camera.turnToTile(nearestTree.getPosition()); Walking.walkTo(nearestTree.getPosition()); } } } private void dropWood() { Inventory.drop(LOG_ID); } }