Jump to content

Warriors Guild Auto Shotpu


Recommended Posts

Posted

First real script iv made for OSBot, pretty simple. Fill your inventory with super energy pots and stand in shotput circle. Run the script and it will autoplay the shotput minigame untill you run out of super energy pots. Good for quick amounts of tokens for getting defenders.

 

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;

@ScriptManifest(name = "ShotPutter", author = "Kanye", version = 1.0, info = "", logo = "")
public class main extends Script {
    private State currentState = State.selectBalls;
    private int currentHealth = -1;

    @Override
    public void onStart() {
        // Code here will execute before the loop is started

    }

    @Override
    public void onExit() {
        // Code here will execute after the script ends

    }

    @SuppressWarnings("unused")
    private State getState() {
        if (currentState == State.drinkPotion) {

        }
        return State.drinkPotion;
    }

    private enum State {
        selectBalls, selectThrow, throwing, drinkPotion;
    }

    private State lastState;
    private int waitCount = 0;
    private int newHealth = -1;

    @Override
    public int onLoop() throws InterruptedException {
        if (lastState != currentState) {
            log(currentState.toString());
        }
        lastState = currentState;
        if (currentState == State.selectBalls) {
            if (dialogues.inDialogue() == true) {
                currentState = State.selectThrow;
            } else {
                Entity ballPile = objects.closest(15665);
                if (waitCount == 0 || waitCount >= 30) {
                    ballPile.interact("Throw");
                    waitCount = 0;
                }
                waitCount++;
            }
        } else if (currentState == State.selectThrow) {
            currentHealth = getSkills().getDynamic(Skill.HITPOINTS);
            log(currentHealth);
            sleep(random(600, 1200));
            if (dialogues.inDialogue() == true) {
                dialogues.selectOption(1);
                currentState = State.throwing;
            }
        } else if (currentState == State.throwing) {
            if (newHealth == -1) {
                newHealth = getSkills().getDynamic(Skill.HITPOINTS);
                if (newHealth > currentHealth) {
                    currentHealth--;
                    log("Current health - 1!!!!!!");
                }

            }
            newHealth = getSkills().getDynamic(Skill.HITPOINTS);
            log(newHealth);
            if (newHealth < currentHealth) {
                currentState = State.drinkPotion;
            }
            myPlayer().getHealth();
            sleep(random(600, 1200));
            if (dialogues.inDialogue() == true
                    && currentState == State.throwing) {
                dialogues.clickContinue();
                currentState = State.drinkPotion;
            }
        } else if (currentState == State.drinkPotion && !dialogues.inDialogue()) {
            newHealth = -1;
            sleep(random(100, 300));
            if (inventory.contains(3022))
                inventory.getItem(3022).interact("Drink");
            else if (inventory.contains(3020))
                inventory.getItem(3020).interact("Drink");
            else if (inventory.contains(3018))
                inventory.getItem(3018).interact("Drink");
            else if (inventory.contains(3016))
                inventory.getItem(3016).interact("Drink");
            else
                stop(true);
            sleep(random(100, 300));
            currentState = State.selectBalls;

        }

        return random(100, 300); // The amount of time in milliseconds before
                                    // the loop starts
        // over
    }

    @Override
    public void onPaint(Graphics2D g) {
        // This is where you will put your code for paint(s)

    }

}

 

Posted (edited)

I have no pictures maybe il update post with one later. It has no progress report overlay or anything. I literally made this in an hour or two. It works fucking all good though.


I've also tried to make it not seem like a bot really. I'd think itd be pretty safe.

 

If people are interested il make a graphic for it with points and hour, with banking etc. But only if people actually care cuz its effort.

Edited by KanyeWest69
Posted

Change the potion to what potion you are using and remove the 'sA.' because it is in your main class. Makes checking/Drinking potions cleaner :)

 public void drinkPotion() throws InterruptedException {
        if (invContainsPotion()) {
            if (sA.getInventory().interactWithNameThatContains(
                    "Drink", "Overload")) {
            }
        }
    }

    public boolean invContainsPotion() {
        for (int i = 0; i <= 4; i++) {
            if (sA.getInventory().contains("Overload (" + i + ")")) {
                return true;
            }
        }
        return false;
    }
Posted

 

Change the potion to what potion you are using and remove the 'sA.' because it is in your main class. Makes checking/Drinking potions cleaner smile.png

 

 

True dat. Also made script that jst drinks prayer pots and overloads for nmz. Theres quite a bunch of things I could do nicer tbh. Just made these for something to do and to see if people are interested.

  • 2 weeks later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...