Jump to content

Beginner needs help


Chris

Recommended Posts

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 :)

Link to comment
Share on other sites

  On 7/23/2015 at 2:25 AM, Tom said:

The cows tend to roam around a bit, so isAnimating might lose a lot of script effectiveness

 

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

 

Edited by OG Scripts
Link to comment
Share on other sites

  On 7/23/2015 at 2:31 AM, OG Scripts said:

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
Link to comment
Share on other sites

  On 7/23/2015 at 2:31 AM, OG Scripts said:

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");
  On 7/23/2015 at 2:33 AM, Tom said:

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

 

Link to comment
Share on other sites

  On 7/23/2015 at 2:38 AM, Sinatra said:

 

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
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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