chrismac1991 Posted June 27, 2015 Share Posted June 27, 2015 so here it is. all it does is cut basic trees and drop after a full inventory of logs. im not sure how to proceed from here yet but im gonna get back at it tomrrow night. ideally i think id like to add an area so it stays within certain coordinates and making it be able to cut oaks aswell as regular trees at 15+ woodcutting. phew. anyway there it is maybe somebody would like to point me in the right direction from here that would be splendid and very much appreciated! am i off to a bad or worse start for just learning how to do all this stuff? import org.osbot.rs07.api.model.Entity;import org.osbot.rs07.script.Script;import org.osbot.rs07.script.ScriptManifest;import java.awt.*;@ScriptManifest(author = "Chris", info = "Chops and Drops Trees Lumbridge", name = "Level3TreeKiller", version = 0.1, logo = "")public class FuckYouTrees extends Script { @Override public void onStart() { log("Kill All The Trees!"); log("Fuck The World"); log("Dont Get Banned Get Bank"); } private enum State { CHOPPING_LOGS, DROPPING_LOGS, SEARCH_FOR_TREE, WAIT }; private State getState() { Entity tree = objects.closest("Tree"); if (inventory.isFull()) return State.DROPPING_LOGS; if (tree != null) if (!myPlayer().isAnimating()) return State.CHOPPING_LOGS; // all good as far i know if (myPlayer().isAnimating()) return State.WAIT; else return State.SEARCH_FOR_TREE; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case DROPPING_LOGS: log("Dropping Shit"); inventory.isFull(); inventory.deselectItem(); log("is inventory full?"); inventory.dropAll(); log("decided to drop"); break; case CHOPPING_LOGS: // time to rest log("Work Work"); Entity tree = objects.closest("Tree"); inventory.deselectItem(); if (tree != null) { log("is tree there?"); if (tree.isVisible()) { log("is tree visible?"); if (!myPlayer().isAnimating()) log("am i already animating?"); if (myPlayer().isMoving()) log("Am i already moving?"); tree.interact("Chop Down"); log("actually chopping"); sleep (gRandom(500,750)); log("sleeping"); break; } } case SEARCH_FOR_TREE: // Switches to case temporarily but does nothing // but spam click. log("Looking for a new tree"); Entity newtree = objects.closest("Tree"); if (newtree != null) camera.toEntity(newtree); newtree.interact("Chop Down"); break; case WAIT: random(1000, 2500); log("waiting"); if (myPlayer().isAnimating()) break; } return random(200, 300); } @Override public void onExit() { log("Done Already?"); } @Override public void onPaint(Graphics2D g) { }} Quote Link to comment Share on other sites More sharing options...
Wealthy Posted June 27, 2015 Share Posted June 27, 2015 best of luck keep @ it dont give up Quote Link to comment Share on other sites More sharing options...
chrismac1991 Posted June 27, 2015 Author Share Posted June 27, 2015 best of luck keep @ it dont give up thanks brah Quote Link to comment Share on other sites More sharing options...
PockerRock Posted June 27, 2015 Share Posted June 27, 2015 Congratz! Keep walking towards your goal! Quote Link to comment Share on other sites More sharing options...
Volta Posted June 27, 2015 Share Posted June 27, 2015 @Override public void onStart() { log("Kill All The Trees!"); log("Fuck The World"); log("Dont Get Banned Get Bank"); } Enjoyed Quote Link to comment Share on other sites More sharing options...
chrismac1991 Posted June 27, 2015 Author Share Posted June 27, 2015 Enjoyed Lol it makes me glad i am not the only person who dislikes trees so much i dont even bank the logs just toss em like meh Quote Link to comment Share on other sites More sharing options...
Volta Posted June 27, 2015 Share Posted June 27, 2015 Lol it makes me glad i am not the only person who dislikes trees so much i dont even bank the logs just toss em like meh smoke trees Quote Link to comment Share on other sites More sharing options...
chrismac1991 Posted June 27, 2015 Author Share Posted June 27, 2015 smoke trees only high grade yews and better ;) Quote Link to comment Share on other sites More sharing options...
darvinb98 Posted June 27, 2015 Share Posted June 27, 2015 congraaaaats mate, keep up the great work Quote Link to comment Share on other sites More sharing options...
chrismac1991 Posted June 29, 2015 Author Share Posted June 29, 2015 (edited) thanks everyone, okay so heres my newest version lol..it now sort of runs away from the Mugger behind the castle because it was aggressive so yeah no more of that! so my next thing is cutting oaks once skill reaches level 15+ could anybody maybe show me how? 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.utility.Area;import java.awt.*;@ScriptManifest(author = "Chris", info = "Chops and Drops Trees Lumbridge", name = "Level3TreeKiller", version = 0.1, logo = "")public class FuckYouTrees extends Script { final Area CHOPPING_AREA = new Area(3160, 3225, 3200, 3243); @Override public void onStart() { log("Kill All The Trees!"); log("Fuck The World"); // /Shit the script says at the beginning log("Dont Get Banned Get Bank"); } private enum State { CHOPPING_LOGS, DROPPING_LOGS, SEARCH_FOR_TREE, WAIT, RUNNINGAWAY // //"Modes" // my // character can // be in }; private State getState() { NPC npc = npcs.closest("Mugger"); Entity tree = objects.closest("Tree"); if (inventory.isFull()) return State.DROPPING_LOGS; if (npc != null) return State.RUNNINGAWAY; if (tree != null) if (!myPlayer().isAnimating()) // how to decide which mode to be return State.CHOPPING_LOGS; if (myPlayer().isAnimating()) return State.WAIT; else return State.SEARCH_FOR_TREE; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case DROPPING_LOGS: log("Dropping Shit"); inventory.isFull(); // what happens when in this case inventory.deselectItem(); log("is inventory full?"); inventory.dropAll(); log("decided to drop"); break; case CHOPPING_LOGS: log("Work Work"); Entity tree = objects.closest("Tree"); inventory.deselectItem(); if (tree != null) { log("is tree there?"); if (tree.isVisible()) { log("is tree visible?"); // /what happens when in this case if (!myPlayer().isAnimating()) log("am i already animating?"); if (myPlayer().isMoving()) log("Am i already moving?"); tree.interact("Chop Down"); log("actually chopping"); sleep(gRandom(400, 750)); log("sleeping"); break; } } case SEARCH_FOR_TREE: log("Looking for a new tree"); Entity newtree = objects.closest("Tree"); if (newtree != null) // what happens when in this case camera.toEntity(newtree); newtree.interact("Chop Down"); break; case WAIT: random(1000, 2500); log("waiting"); // what happens when in this case if (myPlayer().isAnimating()) break; case RUNNINGAWAY: NPC npc = npcs.closest("Mugger"); if (npc != null) log("attempting to runaway"); getLocalWalker().walk(CHOPPING_AREA, true); log("running from Mugger"); break; } return random(200, 300); } @Override public void onExit() { log("Done Already?"); } @Override public void onPaint(Graphics2D g) { }} i may need to add a sleep timer in the running away case, because it kinda took a while and ran back and forth sort of awkwardly..would that be the way to stop that from occuring? Edited June 29, 2015 by chrismac1991 Quote Link to comment Share on other sites More sharing options...
Twin Posted June 29, 2015 Share Posted June 29, 2015 thanks everyone, okay so heres my newest version lol..it now sort of runs away from the Mugger behind the castle because it was aggressive so yeah no more of that! so my next thing is cutting oaks once skill reaches level 15+ could anybody maybe show me how? 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.utility.Area; import java.awt.*; @ScriptManifest(author = "Chris", info = "Chops and Drops Trees Lumbridge", name = "Level3TreeKiller", version = 0.1, logo = "") public class FuckYouTrees extends Script { final Area CHOPPING_AREA = new Area(3160, 3225, 3200, 3243); @Override public void onStart() { log("Kill All The Trees!"); log("Fuck The World"); // /Shit the script says at the beginning log("Dont Get Banned Get Bank"); } private enum State { CHOPPING_LOGS, DROPPING_LOGS, SEARCH_FOR_TREE, WAIT, RUNNINGAWAY // //"Modes" // my // character can // be in }; private State getState() { NPC npc = npcs.closest("Mugger"); Entity tree = objects.closest("Tree"); if (inventory.isFull()) return State.DROPPING_LOGS; if (npc != null) return State.RUNNINGAWAY; if (tree != null) if (!myPlayer().isAnimating()) // how to decide which mode to be return State.CHOPPING_LOGS; if (myPlayer().isAnimating()) return State.WAIT; else return State.SEARCH_FOR_TREE; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case DROPPING_LOGS: log("Dropping Shit"); inventory.isFull(); // what happens when in this case inventory.deselectItem(); log("is inventory full?"); inventory.dropAll(); log("decided to drop"); break; case CHOPPING_LOGS: log("Work Work"); Entity tree = objects.closest("Tree"); inventory.deselectItem(); if (tree != null) { log("is tree there?"); if (tree.isVisible()) { log("is tree visible?"); // /what happens when in this case if (!myPlayer().isAnimating()) log("am i already animating?"); if (myPlayer().isMoving()) log("Am i already moving?"); tree.interact("Chop Down"); log("actually chopping"); sleep(gRandom(400, 750)); log("sleeping"); break; } } case SEARCH_FOR_TREE: log("Looking for a new tree"); Entity newtree = objects.closest("Tree"); if (newtree != null) // what happens when in this case camera.toEntity(newtree); newtree.interact("Chop Down"); break; case WAIT: random(1000, 2500); log("waiting"); // what happens when in this case if (myPlayer().isAnimating()) break; case RUNNINGAWAY: NPC npc = npcs.closest("Mugger"); if (npc != null) log("attempting to runaway"); getLocalWalker().walk(CHOPPING_AREA, true); log("running from Mugger"); break; } return random(200, 300); } @Override public void onExit() { log("Done Already?"); } @Override public void onPaint(Graphics2D g) { } } i may need to add a sleep timer in the running away case, because it kinda took a while and ran back and forth sort of awkwardly..would that be the way to stop that from occuring? You can either have 2 different cases, CUTOAK, CUTTREE, or you can do a boolean inside your chop case. So if(oak &&oakTree!=null || tree&®Tree!=null) Or for the two different cases you can do get the skill level, then check to see if it's greater than or equal to 15, and if it is, cut oaks, and if not, cut trees. Quote Link to comment Share on other sites More sharing options...
chrismac1991 Posted June 29, 2015 Author Share Posted June 29, 2015 You can either have 2 different cases, CUTOAK, CUTTREE, or you can do a boolean inside your chop case. So if(oak &&oakTree!=null || tree&®Tree!=null) Or for the two different cases you can do get the skill level, then check to see if it's greater than or equal to 15, and if it is, cut oaks, and if not, cut trees. ah thanks so much dude! im going to get on this right now 1 Quote Link to comment Share on other sites More sharing options...
Twin Posted June 29, 2015 Share Posted June 29, 2015 ah thanks so much dude! im going to get on this right now Let me know if you need any help! 1 Quote Link to comment Share on other sites More sharing options...
chrismac1991 Posted June 29, 2015 Author Share Posted June 29, 2015 (edited) haha well i got my buddy on skype, and so far we've inserted it into the chop case, and now hes suggesting we make a private method to decide which tree is optimal instead or something lol anyway it looks like this. public void onStart() { log("Kill All The Trees!"); log("Fuck The World"); log("Dont Get Banned Get Bank"); } private enum State { CHOPPING_LOGS, DROPPING_LOGS, WAIT, RUNNINGAWAY }; private State getState() { NPC npc = npcs.closest("Mugger"); Entity tree = objects.closest("Tree"); if (inventory.isFull()) return State.DROPPING_LOGS; if (npc != null) return State.RUNNINGAWAY; if (tree != null) if (!myPlayer().isAnimating()) return State.CHOPPING_LOGS; if (myPlayer().isAnimating()) return State.WAIT; else return null; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case DROPPING_LOGS: log("Dropping Shit"); inventory.isFull(); inventory.deselectItem(); log("is inventory full?"); inventory.dropAll(); log("decided to drop"); break; case CHOPPING_LOGS: log("Work Work"); Entity besttree; Entity oakTree = objects.closest("Oak Tree"); Entity tree = objects.closest("Tree"); boolean oak = skills.getDynamic(Skill.WOODCUTTING) > 15; inventory.deselectItem(); if (oak && oakTree != null) { besttree = oakTree; } else if (tree != null) { besttree = tree; } else { besttree = null; } if (besttree != null) { log("is tree there?"); if (besttree.isVisible()) { if (besttree != null) { camera.toEntity(besttree); log("is tree visible?"); if (!myPlayer().isAnimating()) { log("am i already animating?"); if (myPlayer().isMoving()) { log("Am i already moving?"); besttree.interact("Chop Down"); log("actually chopping"); sleep(gRandom(400, 750)); log("sleeping"); break; } } } } besttree.interact("Chop Down"); } break; case WAIT: random(1000, 2500); log("waiting"); if (myPlayer().isAnimating()) { } break; case RUNNINGAWAY: NPC npc = npcs.closest("Mugger"); if (npc != null) { log("attempting to runaway"); getLocalWalker().walk(CHOPPING_AREA, true); log("running from Mugger"); } break; } return random(200, 300); } version 2.0 is almost done! Edit: currently working on changing the getstate stuff cuz yeah its not gonna work with the changes made Edited June 29, 2015 by chrismac1991 Quote Link to comment Share on other sites More sharing options...
chrismac1991 Posted June 29, 2015 Author Share Posted June 29, 2015 (edited) Annnd done! version 2.0 is here for all actually so proud even though i was walked trough most of it lol import org.osbot.rs07.api.model.Entity;import org.osbot.rs07.api.model.NPC;import org.osbot.rs07.api.ui.Skill;import org.osbot.rs07.script.Script;import org.osbot.rs07.script.ScriptManifest;import org.osbot.rs07.utility.Area;import java.awt.*;@ScriptManifest(author = "ChrisFuckingMac", info = "Chops and Drops Trees Lumbridge", name = "Level3TreeKiller", version = 2.0, logo = "StonerNewb+FriendWhoSurelyGotReallyAnnoyedWithMe")public class FuckYouTrees extends Script { final Area CHOPPING_AREA = new Area(3160, 3225, 3200, 3243); @Override public void onStart() { log("Kill All The Trees!"); log("Fuck The World"); log("Dont Get Banned Get Bank"); } private enum State { CHOPPING_LOGS, DROPPING_LOGS, WAIT, RUNNINGAWAY }; private Entity getbesttree() { Entity besttree; Entity oakTree = objects.closest("Oak"); Entity tree = objects.closest("Tree"); boolean oak = skills.getDynamic(Skill.WOODCUTTING) > 15; inventory.deselectItem(); if (oak && oakTree != null) { besttree = oakTree; } else if (tree != null) { besttree = tree; } else { besttree = null; } return besttree; } private State getState() { NPC npc = npcs.closest("Mugger"); Entity tree = getbesttree(); if (inventory.isFull()) return State.DROPPING_LOGS; if (npc != null) return State.RUNNINGAWAY; if (tree != null) if (!myPlayer().isAnimating()) return State.CHOPPING_LOGS; if (myPlayer().isAnimating()) return State.WAIT; else return null; } @Override public int onLoop() throws InterruptedException { if (skills.getDynamic(Skill.WOODCUTTING) >= 30) { logoutTab.logOut(); } switch (getState()) { case DROPPING_LOGS: log("Dropping Shit"); inventory.isFull(); inventory.deselectItem(); log("is inventory full?"); inventory.dropAll(); log("decided to drop"); break; case CHOPPING_LOGS: Entity besttree = getbesttree(); if (besttree != null) { camera.toEntity(besttree); log("is tree there?"); if (besttree.isVisible()) { log("is tree visible?"); if (!myPlayer().isAnimating()) { log("am i already animating?"); if (!myPlayer().isMoving()) { log("Am i already moving?"); besttree.interact("Chop Down"); log("actually chopping"); sleep(gRandom(400, 750)); log("sleeping"); } } } } break; case WAIT: random(1000, 2500); log("waiting"); if (myPlayer().isAnimating()) { } break; case RUNNINGAWAY: NPC npc = npcs.closest("Mugger"); if (npc != null) { log("attempting to runaway"); getLocalWalker().walk(CHOPPING_AREA, true); log("running from Mugger"); } break; } return random(200, 300); } @Override public void onExit() { log("Done Already?"); } @Override public void onPaint(Graphics2D g) { }} so it should... Run away from mugger behind lumbridge castle chop oaks over trees when available logout at 30 woodcutting drops everything. if you're going to use it i recommend starting it behind the castle someplace as thats where the area i made is. next i learn to use the paint! Edited June 29, 2015 by chrismac1991 1 Quote Link to comment Share on other sites More sharing options...