Jump to content

Beginner needs help


Recommended Posts

Posted
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import javax.swing.text.Position;
import java.awt.*;

@ScriptManifest(author = "Sinatra", info = "", name = "Kil", version = 0.1, logo = "")
public class Skeleton extends Script {

    @Override
    public void onStart() {
        /*code that will run*/
        log("Welcome -- Starting the mothafukin script!");
    }

    @Override
    public int onLoop() throws InterruptedException {
        final NPC Cow = this.npcs.closest("Cow", "Cow calf");
            if(!this.myPlayer().isUnderAttack() && this.myPlayer().getInteracting() == null && Cow != null && Cow.isVisible()) {
                Cow.interact("Attack ");
                sleep(random(300, 600));

            } else {
                camera.toEntity(Cow);
                sleep(random(300, 600));
            }

        return (random(100,300));
    }

    @Override
    public void onExit() {
    log("Thank you for testing my script!");
        log("Let me know if you run in to problems!");
    }

    @Override
    public void onPaint(Graphics2D g) {

    }

The script runs! But how do I make it not attack other peoples cows? It keeps spam clicking! sorry I am new :)

Posted (edited)

That is true, but cows also will be animating while they are under attack. So it also helps filter out cows that are being attacked. But I do agree that script effectiveness could be lost

 

 

You could debug the game and find the walking animation and the standing animation, then its just a matter of 

if(cow.getAnimation() == #### ){
etc
}

But who can be bothered doing that

Edited by Tom
Posted

That is true, but cows also will be animating while they are under attack. So it also helps filter out cows that are being attacked. But I do agree that script effectiveness could be lost

 

So something like this 

if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() &&
                        this.myPlayer().getInteracting() == null && Cow != null && Cow.isVisible()) {
                    Cow.interact("Attack");

You could debug the game and find the walking animation and the standing animation, then its just a matter of 

if(cow.getAnimation() == #### ){
etc
}

But who can be bothered doing that

 

Posted

 

So something like this 

if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() &&
                        this.myPlayer().getInteracting() == null && Cow != null && Cow.isVisible()) {
                    Cow.interact("Attack");
if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() && !this.myPlayer().isAnimating()){
           
           Cow.interact("Attack");
}
  • Like 1
  • 1 year 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...