Prismo Posted June 3, 2017 Posted June 3, 2017 (edited) hi guys ! trying to write my own script , could you please show me an example of how to interact with a entity ie oak tree (correctly) once i define a entity ie "oak tree" do i have to write full name in other lines? or just "tree" private State getState() { Entity Oak_tree = getObjects().closest("Oak tree"); if (!inventory.isFull()) return State.BANK; if (Oak_tree != null) return State.CHOP; return State.WAIT; a snippet of how to change camera angle would me epic also! i have this.client.rotateCameraPitch(50 + random(40)); the rotatecamerapitch part has no reference :\ would appreciate any help , thank you ! Edited June 3, 2017 by Prismo
Sysm Posted June 3, 2017 Posted June 3, 2017 9 minutes ago, Prismo said: hi guys ! trying to write my own script , could you please show me an example of how to interact with a entity ie oak tree (correctly) once i define a entity ie "oak tree" do i have to write full name in other lines? or just "tree" private State getState() { Entity Oak_tree = getObjects().closest("Oak tree"); if (!inventory.isFull()) return State.BANK; if (Oak_tree != null) return State.CHOP; return State.WAIT; a snippet of how to change camera angle would me epic also! i have this.client.rotateCameraPitch(50 + random(40)); the rotatecamerapitch part has no reference :\ would appreciate any help , thank you ! RS2Object oak = getObjects().closest("Oak tree"); ^after doing this ur oak tree will be "oak" in the script and use the above line to define it so example: if (oak != null && oak.interact("Chop")) { ^ now it will chop a oak (oak = Oak tree) if u get what i mean ? also camera change: getCamera().mouseRotateToYaw((100)); hope this helps you out 1
HeyImJamie Posted June 3, 2017 Posted June 3, 2017 (edited) public boolean chopTree(String treeName) { //run this code until it returns a value if (!myPlayer().isAnimating()) { //WE ARE NOT CUTTING THEN WE CUT status = "Waiting for Tree."; RS2Object tree = getObjects().closest(treeName); if (tree != null) { if (tree.interact("Chop down")) { status = "Cutting Tree."; new ConditionalSleep(3500, 600) { //sleep until chopping @Override public boolean condition() { return myPlayer().isAnimating(); // We're chopping/Animating. } }.sleep(); return true; //we have clicked the tree! } } } return false; } Here's my chopping tree code if it's any use. Edited June 3, 2017 by HeyImJamie 3
Prismo Posted June 3, 2017 Author Posted June 3, 2017 ah yes! it has all become clear now! nah thanks heaps guys ! 1+ @HeyImJamie Ty for code mate, i am not quite at that level, with the conditions and all... ty for post !
HeyImJamie Posted June 3, 2017 Posted June 3, 2017 7 minutes ago, Prismo said: ah yes! it has all become clear now! nah thanks heaps guys ! 1+ @HeyImJamie Ty for code mate, i am not quite at that level, with the conditions and all... ty for post ! Copy it if you need. All you need to do is store a tree name as a String, and then in the loop is call chopTree(STORED_STRING_HERE). Saves you having to re-type it for multiple trees 2
Prismo Posted June 3, 2017 Author Posted June 3, 2017 ah nice, i knew there was a better way ! ill give you a free trial when im done