Jump to content

A Beginners Guide to Writing OSBot Scripts (where to get started!) by Apaec


Apaec

Recommended Posts

2 minutes ago, lfcandy said:

@Apaec I get the same error now for RS2Object  now. I have the OSBot 2.4.118 jar in referenced libraries. Eclipse quick-fixed it for me when I clicked on RS2Object  and selected import RS2Object(or something similar). not sure what was going on

Can you send me a screenshot of the exact error you're getting perhaps?

Link to comment
Share on other sites

  • 2 weeks later...

Alright so I'm trying to make a basic powerfisher using my very limited knowledge.

Here's what I have
 


 

Quote

 

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

@ScriptManifest(name = "skeetfish", author = "skeetballs", version = 1.0, info = "", logo = "") 

public class Todfish extends Script {

private enum State {
    FISH, DROP, WAIT
};

private State getState() {
    NPC fishspot = (NPC) objects.closest("Fishing Spot");
    if (!inventory.isEmptyExcept("Feather","Fly fishing rod"))
        return State.DROP;
    if (fishspot != null)
        return State.FISH;
    return State.WAIT;
}

@Override

public int onLoop() throws InterruptedException {

switch (getState()) {

case FISH:

NPC fishspot = (NPC) objects.closest("Fishing spot");

if (fishspot != null) {

fishspot.interact("Lure");

}

break;

case DROP:

inventory.dropAll("Trout","Salmon");

break;

case WAIT:

sleep(random(500, 700));

break;

}

return random(200, 300);

}
}
 

 

 

Edited by skeetballs
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 2 weeks 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...