Jump to content

Imthabawse

Members
  • Posts

    278
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Imthabawse

  1. Thanks for the feedback! :]
  2. As @Xx pk xX said if used correctly drops faster then the average human can
  3. @t0r3 Haven't tryed using booleans like you've implemented but seen it used in @Explv's tutorial on scripting and I like how much cleaner it looks will have to try it out in one of my scripts. As for the script, to me it looks really clean and well organized so good job there. Curious as to how it's functioning. Keep on scripting brotha you're progressing pretty fast. ?
  4. Couldn't you just say if (myPlayer().getHealthPercent() < 50 && getInventory().contains("Shark")) { Health % below 50 & Inventory contains sharks log("I got an owie, let's eat!"); getInventory().interact("Eat", "Shark"); Eats a shark } }
  5. Made an updated version of my first Frog killing script. Whats new? - Teleport to Lumbridge Castle if you have the proper runes in you're inventory, walks to bank and withdraws more Tuna. - If you don't have the level to cast Teleport have no fear. I've added an option for walking as well Id like to add: - @Explv's sleep curious how I can add it to the API to use in all my scripts - Moving of camera to NPC when im attacking it and it's not visible on screen - Logging out (Stopping script) if out of Tuna in the bank Feedback appreciated! CODE: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Frog killer", logo = "", version = 1, author = "Imthabawse", info = "Kills frogs for gains") public final class FrogKiller extends Script { private final Area killArea = new Area(3208, 3168, 3194, 3181); private final Area teleArea = new Area(3226, 3227, 3217, 3212); @Override public void onStart() { log("Welcome to Frog Killer.. let's get to it!"); } @Override public int onLoop() throws InterruptedException { killFrog(); bank(); eat(); return 2500; } private void eat() { if (myPlayer().getHealthPercent() < 55 && getInventory().contains("Tuna")) { log("I got an owie, let's eat!"); getInventory().interact("Eat", "Tuna"); } } private void bank() throws InterruptedException { if (!getInventory().contains("Tuna") && !myPlayer().isAnimating() && !myPlayer().isMoving() && getInventory().contains("Air rune", "Earth rune", "Law rune")) { log("Teleportings for cool kids!"); getMagic().castSpell(Spells.NormalSpells.LUMBRIDGE_TELEPORT); new ConditionalSleep(10000) { @Override public boolean condition() { return teleArea.contains(myPosition()); } }.sleep(); log("Walking to bank.. please wait patiently."); getWalking().webWalk(Banks.LUMBRIDGE_UPPER); log("Opening bank.."); getBank().open(); log("Withdrawling Tuna's.."); getBank().withdrawAll("Tuna"); getTabs().open(Tab.INVENTORY); new ConditionalSleep(5000) { @Override public boolean condition() { return getInventory().contains("Tuna"); } }.sleep(); } else if (!getInventory().contains("Tuna") && !myPlayer().isAnimating() && !myPlayer().isMoving()) { log("Welp can't tele.. let's walk..."); getWalking().webWalk(Banks.LUMBRIDGE_UPPER); log("Opening bank.."); getBank().open(); log("Withdrawlings Tuna's.."); getBank().withdrawAll("Tuna"); getTabs().open(Tab.INVENTORY); new ConditionalSleep(5000) { @Override public boolean condition() { return getInventory().contains("Tuna"); } }.sleep(); } } private void killFrog() { if (!killArea.contains(myPosition()) && getInventory().contains("Tuna")) { log("Let's get to killing!"); getWalking().webWalk(killArea); } else if (killArea.contains(myPosition()) && !myPlayer().isAnimating() && !myPlayer().isMoving() && getInventory().contains("Tuna")) { NPC frog = getNpcs().closest(killArea,"Giant frog","Big frog"); if (!frog.isUnderAttack() && !frog.isHitBarVisible() && frog.isOnScreen()) { log("DIE! FROG! DIE!"); frog.interact("Attack"); new ConditionalSleep(5000) { @Override public boolean condition() { return myPlayer().isAnimating(); } }.sleep(); } } } }
  6. So as @Chris and @Eagle Scripts said learn some basic Java first also check out the Scripting tutorials section for further help. @Explv's tut here: @Apaec's tut here: Java basics: https://en.wikipedia.org/wiki/Java_syntax Hope this helps!
  7. @t0r3 Yeah no need to create object for bank the API has built in Bank.functions
  8. @t0r3 Maybe add }else if (treeArea.doesContainMyPosition to your else if. Probably not necessary to get chopping but can't hurt. Looks clean though.
  9. 137 lines into a progressive wc'er based around Draynor later... and I'm bout over it ? lol. Fun little project while being a pain in the ass at the same time. Kudos to you for taking on such a task haha.
  10. Bank () Chop () Getaxe () If (inv is full) { Bank () }else { Chop () Getaxe () Perhaps that would work
  11. @t0r3 ConditionalSleeps are a better practice also if you plan on banking logs I would suggest something like so.. Public int onloop() { If(getInventory().isFull() { getWalking.webWalk.bankArea; Bank.open.depositAllexcept (blah blah blah) }else { Chop (); There's 2 options here either your inventory is full and you must bank otherwise you can chop
  12. For your chop method I would add a ConditionalSleep after you interact(Chop) tree's So after tree.interact ("Chop"); new ConditionalSleep (2500) { Sleeps for 2 1/2 seconds or untill the conditions met return myPlayer ().isAnimating; Will continue to chop trees once your players not animating. How does script run? Curious. Also as @Chris said no need for creating RS2object for bank API contains Bank.methods
  13. I have a single dungeon room which is small enough that .closest works just fine. Ran it for bout an hour straight no issues.
  14. Might have fixed..Got rid of area and added: RS2Object builtdoor = getObjects().closest("Door"); if(builtdoor == null) { doorSpace.interact("Build"); into the Build() method. Seems to be working so far as always can use tweaks here and there. Will edit code in original post to working version.
  15. @FuryShark Yup seems to be the case. Thanks for pointing that out. Back to the drawling boards lol.
  16. *Edited original post above with updated code
  17. @FuryShark Don't believe so can test this though.
  18. Hello again and welcome back to Oak Doors V2 this time around I've implemented only ConditionalSleeps seems to run pretty smooth. To start it you need: - Saw/Crystal Saw - Hammer - Nails - Demon butler (Servant) - Have his task set to withdraw (20) oak planks from bank - Start script in player owned dungeon (Single room) - Call Servant at least once before starting script - Money bag with money in it (preferably 500k+ for longer runs) - Have Build mode ON Once all these have been met start script and sit back and enjoy the levels Thing's to improve: - Interact with Butler before completely out of Oak planks so constantly building/removing and having butler fetch planks (Faster EXP rates) I know about the && operator as well so don't hate just how I like to write for time being. ? All feedback both Negative && Positive are welcome. Code below. ? import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Perfect Doors", logo = "", version = 1, author = "Imthabawse", info = "Makes Oak doors, calls for butler to get planks from bank.") public class PerfectDoors extends Script { // To start script: 1. Building mode ON 2. Oak planks in bank 3. Have Hammer, Saw, Nails in inventory // oak door area // butler area // build/remove code private void build() { if (getInventory().getAmount("Oak plank") >= 10) { if (!myPlayer().isAnimating()) { if (!myPlayer().isMoving()) { RS2Object doorSpace = getObjects().closest("Door space"); log("Getting Door space.."); if (doorSpace != null) { RS2Object builtdoor = getObjects().closest("Door"); if(builtdoor == null) { doorSpace.interact("Build"); log("Interacting with Door space."); new ConditionalSleep(2000) { @Override public boolean condition() { return getWidgets().getWidgetContainingText("Furniture Creation Menu") != null; } }.sleep(); RS2Widget oakDoor = getWidgets().get(458, 4, 4); if (oakDoor != null) { oakDoor.interact(); log("Building.."); new ConditionalSleep(2000) { @Override public boolean condition() { return myPlayer().isAnimating(); } }.sleep(); } } } } } } } private void remove() { RS2Object door = getObjects().closest("Door"); log("Getting Door"); if (door != null) { if (!myPlayer().isAnimating()) { door.interact("Remove"); log("Interacting with Door."); new ConditionalSleep(2000) { @Override public boolean condition() { return getWidgets().getWidgetContainingText("Really remove it?") != null; } }.sleep(); RS2Widget yes = getWidgets().getWidgetContainingText("Yes"); if (yes != null) { if (!myPlayer().isAnimating()) { yes.interact(); log("Removing Door.."); new ConditionalSleep(2000) { @Override public boolean condition() { return myPlayer().isAnimating(); } }.sleep(); } } } } } // butler code private void butler() throws InterruptedException { if (getInventory().getAmount("Oak plank") < 10) { if (!myPlayer().isAnimating()) { NPC demonbutler = getNpcs().closest("Demon butler"); log("Getting butler.."); if (demonbutler != null) { demonbutler.interact("Talk-to"); log("Interacting with butler."); new ConditionalSleep(2000) { @Override public boolean condition() { return getWidgets().getWidgetContainingText("Repeat last task?") != null; } }.sleep(); RS2Widget fetch = getWidgets().getWidgetContainingText("Fetch from bank: 20 x Oak plank"); if (fetch != null) { fetch.interact(); log("Waiting on planks to build.."); sleep(random(300, 600)); getMouse().moveOutsideScreen(); new ConditionalSleep(7200) { @Override public boolean condition() { return getInventory().getAmount("Oak plank") >= 10; } }.sleep(); } } } } } @Override public int onLoop() throws InterruptedException { if(myPlayer().getAnimation() < 1) { build(); remove(); butler(); } return 1500; } }
  19. How I go about it is like this: import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(name = "Example", logo = "", version = 1, author = "Your name here", info = "Example script") public class Example extends Script { private void exampleMethod() { // Put your method in here and call in the onLoop with conditions } @Override public int onLoop() throws InterruptedException { // if(Im where I need to be) { <--- Condition to run method // exampleMethod(); <--- Method is executed if condition met return 0; } } Not saying this is the "proper" OR best way to go about it but works for me. Have only used this for the simplest of tasks though. For more complex scripts I'm sure there's far better ways to structure it. Hope this helps.
  20. Update: Added a banking method and added into onLoop. Only works for Tuna for now till I play around with it. Also the Air rune and Earth rune are only there cause I was testing and had in my inv. private void bank() throws InterruptedException { if(getInventory().isEmptyExcept("Air rune","Earth rune")) { log("Inventory contains no food, banking."); getWalking().webWalk(Banks.LUMBRIDGE_UPPER); getBank().open(); bank.withdrawAll("Tuna"); } } onLoop @Override public int onLoop() throws InterruptedException { if(!killArea.contains(myPlayer())) { log("Not in kill area.. lets get there and slaughter more frogs!"); getWalking().webWalk(killArea); }else { if (killArea.contains(myPlayer())) { killFrog(); eatFood(); bank(); } } return 1200; } } Needs improvement and will mess around with it over time but gets the job done and gets some good levels for F2P pure accounts.
  21. @HunterRS Thanks for the quick reply. I'll have to play around with this but for now it seems to work alright. ?
  22. Mines ore's and banks them. Simple. Planning on getting into GUI to add option's like drop OR bank. Any tip's on how to go about that would be helpful! I also know there are guides on here and will be reading them as well. CODE: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Iron miner", logo = "", version = 1, author = "Imthabawse", info = "Mine & Drop Iron ore") public class Iron extends Script { private Area ironArea = new Area(3288, 3371, 3284, 3367); private void bank() { if (Banks.VARROCK_EAST.contains(myPlayer())) { RS2Object banker = getObjects().closest("Bank booth"); log("In bank.. getting closest banker."); if (banker != null) { banker.interact("Bank"); log("Banking.."); new ConditionalSleep(2000) { @Override public boolean condition() { return bank.isOpen() && getInventory().isEmpty(); } }.sleep(); } if (bank.isOpen()) { bank.depositAll(); } } else { if (!Banks.VARROCK_EAST.contains(myPlayer())) { getWalking().webWalk(Banks.VARROCK_EAST); log("Not in bank.. walking there."); } } } private void mineIron() { if (ironArea.contains(myPlayer())) { if (!myPlayer().isAnimating()) { if (!myPlayer().isMoving()) { if (!getInventory().isFull()) { RS2Object ironore = getObjects().closest(7488); log("Getting closest iron ore."); if (ironore != null) { ironore.interact("Mine"); log("Mining.."); new ConditionalSleep(3500) { @Override public boolean condition() { return myPlayer().isAnimating() && myPlayer().isMoving(); } }.sleep(); } } } } }else{ if(!ironArea.contains(myPlayer())) { log("Walking to mining area. "); getWalking().webWalk(ironArea); } } } @Override public int onLoop() { if(getInventory().isFull()) { log("Inventory FULL banking."); bank(); }else{ mineIron(); } return 1500; } }
  23. @Script Kid Thanks for the feedback!
  24. Yes I know about the && (and) just like to write it out if's{ the first time cause I'm weird. ?
×
×
  • Create New...