Jeef_
-
Posts
6 -
Joined
-
Last visited
-
Feedback
0%
Posts posted by Jeef_
-
-
11 hours ago, d0zza said:
NPC cow = getNpcs().closest("Cow", "Cow calf");
That line is causing your script to not start. You need to call it in your onLoop().
I moved it to the onLoop(), but I also had to add it in my getState(). Is it supposed to be like that? Because it seems redundant.
-
Okay, So this is my second Script. First one is a simple Shrimp catcher at and it does the basic it fishes and drops.
Trying to make a combat script that loots and banks but I don't understand why my code doesn't even start up, Literally does nothing.
import java.util.Objects; import org.osbot.rs07.api.GroundItems; import org.osbot.rs07.api.Inventory; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Jeef_", info = "Kills Cows and Banks", name = "CowKiller", version = 0, logo = "") public class main extends Script{ Area Cowpen = new Area(3253, 3255, 3265, 3296).setPlane(0); Area lumbank = new Area(3208, 3218, 3210, 3220).setPlane(2); NPC cow = getNpcs().closest("Cow", "Cow calf"); public void onStart() { } public enum State { WALK, BANK, KILL, WAIT; } public State getState() { if (getInventory().isFull()) { // FULL COWHIDE return State.BANK; } if (!Cowpen.contains(myPlayer())) { // IF I'M NOT AT THE COWPEN return State.WALK; } if (cow != null && cow.exists() && cow.isAttackable() && !inventory.isFull()) { //KILLING COWS return State.KILL; } if (myPlayer().isAnimating()) { // PROGRESS KILLING COWS return State.WAIT; } return null; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case BANK: RS2Object banker = getObjects().closest("Bank booth"); if (getWalking().webWalk(lumbank)) { if (banker != null) { if (banker.interact("Bank")) { if (bank.isOpen()) { if (bank.depositAll()) { Timing.waitCondition(() -> inventory.isEmpty(), random (2000, 5000)); } } } } } break; case WALK: if (getWalking().webWalk(Cowpen)) { Timing.waitCondition(() -> Cowpen.contains(myPlayer()), random(2000, 5000)); } break; case KILL: GroundItem hide = getGroundItems().closest("Cowhide"); if (cow.interact("Attack")) { Timing.waitCondition(() -> myPlayer().isUnderAttack() || myPlayer().isAnimating(), random(2000, 3000)); if (!inventory.isFull()) { hide.interact("Take"); sleep (random(500,900)); } } break; case WAIT: sleep (random(500, 900)); break; } return 0; } }
So.. My Script Not Starting
in Scripting Help
Posted
Oh I remember your name, you made the Macro Killer I believe.
So I changed up a few things.
public enum State { WALK, BANK, KILL, WAIT, IDLE; } public State getState() { NPC cow = getNpcs().closest("Cow", "Cow calf"); if (cow != null && cow.exists() && cow.isAttackable() && !myPlayer().isUnderAttack()) { //KILLING COWS return State.KILL; } if (myPlayer().isAnimating()) { // PROGRESS KILLING COWS return State.WAIT; } return State.IDLE; public int onLoop() throws InterruptedException { NPC cow = getNpcs().closest("Cow", "Cow calf"); switch (getState()) { case KILL: if (myPlayer().isAnimating()) { lastAnimation = System.currentTimeMillis(); } else if (System.currentTimeMillis() > (lastAnimation + 2500)) { if (cow.interact("Attack")) { Timing.waitCondition(() -> myPlayer().isUnderAttack(), random(2000, 3000)); } } break; case WAIT: sleep (random(500,900)); break; } return 0; }
Just showed what I thought would be important.
My Logic behind this, and please correct me if I'm wrong - which I'm sure I am.
I thought it would work like this but there are multiple issues I'm having.
Having performance issues where once the script is on, the client will be really laggy, sometimes to the point where I have to open task manager to even close the client.
Takes forever for me to even attack a Cow in the first place
Sometimes would spam click on the cow.