Jump to content

TheKillerAurial

Members
  • Posts

    3
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Female

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheKillerAurial's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. Thanks for the advice - really appreciate it. Could you show me an example for the grounditems -> list option?
  2. Hi Scripting Community, I would like to get some feedback on my first script TSRunner (Trout Salmon Runner). I have some background in software development and testing but would not consider myself a developer. I have written the below script to run to the fishing spot in barb village and collect fish on the ground , then head to the GE to bank and repeat (I chose not to go to edge bank)- I have tested it for 2hrs+ and seems to be working (20-25k per hour)- albeit it seems to be competing with many looting bots in the area. One problem I have been experiencing is if there is a large loot pile on the floor, it always seems to try and "take" the first one. I'm guessing it is trying to "take" index 0. Can you specify the index in anyway so say if there is a pile on the floor it will take the 6th or 7th item if it exists? Code: import java.awt.Graphics2D; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.event.WebWalkEvent; import org.osbot.rs07.event.webwalk.PathPreferenceProfile; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Aurial", info = "Trout - Salmon Runner", logo = "", name = "TSRunner", version = 1) public class TSRunnerScript extends Script { private Area fishLocation = new Area(3104, 3435, 3109, 3431); private Area bankLocation = new Area(3161, 3492, 3168, 3486); enum State { RUNNING2BANK, RUNNING2FISH, LOOTING; } private State currentState; private Boolean checkInventoryIsEmpty(){ if(inventory.isEmpty()){ log("TSRunner || Inventory IS empty."); return true; } else { log("TSRunner || Inventory IS NOT empty!"); log("TSRunner || Will attempt to Bank items"); return false; } } private void goToFishSpot() throws InterruptedException { if(!inventory.isEmpty()){ currentState = State.RUNNING2BANK; } else { log("TSRunner || Heading to fishing location..."); WebWalkEvent webEvent = new WebWalkEvent(fishLocation); webEvent.useSimplePath(); PathPreferenceProfile ppp = new PathPreferenceProfile(); ppp.setAllowTeleports(false); webEvent.setPathPreferenceProfile(ppp); execute(webEvent); log("TSRunner || Arrived at fishing location..."); sleep(random(300,500)); } } private void lootFish() throws InterruptedException { log("TSRunner || Looting fish..."); while (!inventory.isFull()){ if(!myPlayer().isAnimating() || !myPlayer().isMoving() || !myPlayer().isUnderAttack()){ GroundItem fishies = getGroundItems().closest("Salmon", "Trout", "Raw salmon", "Raw trout"); if(fishies != null){ if(inventory.isEmpty()){ fishies.interact("Walk here"); } sleep(random(20, 333)); fishies.interact("Take"); sleep(random(20, 333)); } } } if(inventory.isFull()){ log("TSRunner || Inventory is full."); currentState = State.RUNNING2BANK; } } private void goToBankAndDepositFish() throws InterruptedException { log("TSRunner || Heading to bank location..."); WebWalkEvent webEvent = new WebWalkEvent(bankLocation); webEvent.useSimplePath(); PathPreferenceProfile ppp = new PathPreferenceProfile(); ppp.setAllowTeleports(false); webEvent.setPathPreferenceProfile(ppp); execute(webEvent); log("TSRunner || Arrived at bank location..."); sleep(random(300,500)); if (!myPlayer().isAnimating() || !myPlayer().isMoving() || !myPlayer().isUnderAttack()) { log("TSRunner || Attempting to deposit all..."); sleep(random(300,500)); if (inventory.isFull()) { if (getBank().isOpen()) { sleep(random(200,300)); getBank().depositAll(); sleep(random(50, 100)); log("TSRunner || Banking finished..."); currentState = State.RUNNING2FISH; } else { sleep(random(300,500)); getBank().open(); sleep(random(200,300)); getBank().depositAll(); sleep(random(50, 100)); log("TSRunner || Banking finished..."); currentState = State.RUNNING2FISH; } } } } @Override public void onStart(){ log("-----------------------"); log("TSRunner || Starting..."); log("-----------------------"); if (checkInventoryIsEmpty()){ currentState = State.RUNNING2FISH; } else { currentState = State.RUNNING2BANK; } } @Override public int onLoop() throws InterruptedException{ switch (currentState){ case RUNNING2FISH: return first(); case LOOTING: return second(); case RUNNING2BANK: return third(); } return random(200, 300); } private int first() throws InterruptedException { goToFishSpot(); currentState = State.LOOTING; return random(200, 300); } private int second() throws InterruptedException{ lootFish(); return random(200,300); } private int third() throws InterruptedException{ goToBankAndDepositFish(); return random(200,300); } @Override public void onExit(){ log("---------------------"); log("TSRunner || Ending..."); log("---------------------"); } @Override public void onPaint(Graphics2D g){ } }
×
×
  • Create New...