Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • im learnding haha


    simbo

    Recommended Posts

    Posted

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.wrappers.interactive.GameObject;
    @ScriptManifest(author = "Simbo", name = "My First Script", version = 1.0, description = "Fisher", category = Category.FISHING)
    public class main extends AbstractScript {
    public void onStart() {
    log("Welcome to Simbo's Fisher.");
    log("If you experience any issues while running this script please report them to me on the forums.");
    log("Enjoy the script, gain some fishing levels!.");
    }
    private enum State {
    FISH, DROP, WAIT
    };
    private State getState() {
    GameObject fishspot = getGameObjects().closest("fishspot");
    if (!getInventory().isEmpty())
    return State.DROP;
    if (fishspot != null)
    return State.FISH;
    return State.WAIT;
    }
    public void onExit() {
    }
    @Override
    public int onLoop() {
    switch (getState()) {
    case FISH:
    GameObject fishspot = getGameObjects().closest("fishspot");
    if (fishspot != null) {
    fishspot.interact("net");
    }
    break;
    case DROP:
    getInventory().dropAll("shrimp");
    break;
    case WAIT:
    sleep(Calculations.random(500, 600));
    break;
    }
    return Calculations.random(500, 600);
    }
    }

     

     

    ok so I'm a complete noob at this just wondering if a scripter might be willing to give me a hand on a few really noob questions

     

    this is apaecs tea thiever I'm converting to a net fisher for experience however I'm abit lost

     

    return State.WAIT; < would this ever be true while fishing anywhere

     

    GameObject fishspot = getGameObjects().closest("fishspot"); < would this be correct to always find the node?

    fishspot.interact("net");< is this the correct procedure for net fishing I did say complete noob :P

     

    any pointers would be greatly appreciated thanks in advance simbo :)

    Posted

    Fishspots are NPCs not GameObjects. "Net" not "net". GL!

    Posted

    I'd recommend learning the absolute basics of Java before actually trying to write a script that would be complex to a new starter.

     

    I go to codeacademy (google it) for EVERY basics course I need on a load of programming languages, Python / Java / JavaScript ect...

     

    Hope my advice helps and best of luck in your programming adventure!

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.