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
  • Try asking for help in the chatbox
  • need some help with my first script


    Grundyr
     Share

    Recommended Posts

    hello there,

     

    so i just tried tomake my first script for picking up ashes at the GE,

     

    ive copied the cabage picker script and tried to implement some things of my own,

    i know it is shit but dont be to hard on me :/

    /**
    
    * Created by Gundyr on 7-11-2016.
    
    */
    
    
    
    import org.dreambot.api.methods.Calculations;
    
    import org.dreambot.api.methods.map.Area;
    
    import org.dreambot.api.methods.map.Tile;
    
    import org.dreambot.api.script.AbstractScript;
    
    import org.dreambot.api.script.ScriptManifest;
    
    
    
    @ScriptManifest(name = "ash picker", description = "Picks ashes in grand exchange", version = "1.0", category = "other")
    
    public class main extends AbstractScript{
    
    
    
    area Grandexchange = new Area (3147, 3476, 3180,3504);
    
    area Bank = new Tile(3167, 3489);
    
    GameObject = Ashes;
    
    GameObject = Bank;
    
    
    
    }public int onLoop()
    
    
    
    {if (!getInventory().isFull()) {
    
    if (Grandexchange.contains(getLocalPlayer())) {
    
    Ashes = getGameObjects().closest(a -> a != null && a.getName().equals("Ashes") && a.hasAction("Pick"));
    
    Ashes.interact("Pick");
    
    sleepUntil(() -> getLocalPlayer().getAnimation() == 882, Calculations.random(328, 412));
    
    
    
    } else {
    
    getWalking().walk(Grandexchange.getRandomtile());
    
    sleep(Calculations.random("1334,1586"));
    
    }
    
    } else{
    
    if(Bank.distance(getLocalPlayer()) <= 3) {
    
    if (getBank().isOpen()); {
    
    getBank().depositAllItems();
    
    
    
    } else{
    
    if (getBank().distance(getLocalPlayer()) <= 5) {
    
    if (getBank().isOpen()) {
    
    getBank().depositAllItems();
    
    } else {
    
    Bank = getGameObjects().closest(b -> b != null && b.getName().equals("Banker") && d.hasAction("Bank banker"));
    
    Bank.interact("Deposit");
    
    sleepUntil(() -> getBank().isOpen(), Calculations.random(743, 1694));
    
    } else{
    
    getWalking().walk(Bank);
    
    sleep(Calculations.random(1638, 2584));
    
    }
    
    
    
    }
    
    return Calculations.random(362, 625);
    
    }
    
    
    
    }
    
    {
    
    }
    
    

     i cant compile it and i dont know what i did wrong.

    Link to comment
    Share on other sites

    hello there,

     

    so i just tried tomake my first script for picking up ashes at the GE,

     

    ive copied the cabage picker script and tried to implement some things of my own,

    i know it is shit but dont be to hard on me :/

    /**
    
    * Created by Gundyr on 7-11-2016.
    
    */
    
    
    
    import org.dreambot.api.methods.Calculations;
    
    import org.dreambot.api.methods.map.Area;
    
    import org.dreambot.api.methods.map.Tile;
    
    import org.dreambot.api.script.AbstractScript;
    
    import org.dreambot.api.script.ScriptManifest;
    
    
    
    @ScriptManifest(name = "ash picker", description = "Picks ashes in grand exchange", version = "1.0", category = "other")
    
    public class main extends AbstractScript{
    
    
    
    area Grandexchange = new Area (3147, 3476, 3180,3504);
    
    area Bank = new Tile(3167, 3489);
    
    GameObject = Ashes;
    
    GameObject = Bank;
    
    
    
    }public int onLoop()
    
    
    
    {if (!getInventory().isFull()) {
    
    if (Grandexchange.contains(getLocalPlayer())) {
    
    Ashes = getGameObjects().closest(a -> a != null && a.getName().equals("Ashes") && a.hasAction("Pick"));
    
    Ashes.interact("Pick");
    
    sleepUntil(() -> getLocalPlayer().getAnimation() == 882, Calculations.random(328, 412));
    
    
    
    } else {
    
    getWalking().walk(Grandexchange.getRandomtile());
    
    sleep(Calculations.random("1334,1586"));
    
    }
    
    } else{
    
    if(Bank.distance(getLocalPlayer()) <= 3) {
    
    if (getBank().isOpen()); {
    
    getBank().depositAllItems();
    
    
    
    } else{
    
    if (getBank().distance(getLocalPlayer()) <= 5) {
    
    if (getBank().isOpen()) {
    
    getBank().depositAllItems();
    
    } else {
    
    Bank = getGameObjects().closest(b -> b != null && b.getName().equals("Banker") && d.hasAction("Bank banker"));
    
    Bank.interact("Deposit");
    
    sleepUntil(() -> getBank().isOpen(), Calculations.random(743, 1694));
    
    } else{
    
    getWalking().walk(Bank);
    
    sleep(Calculations.random(1638, 2584));
    
    }
    
    
    
    }
    
    return Calculations.random(362, 625);
    
    }
    
    
    
    }
    
    {
    
    }
    
    

     i cant compile it and i dont know what i did wrong.

    The action for picking up items is called "Take" not pick so in your case it would be a.hasAction("Take");

     

    Also the banking method would be banker.hasAction("Bank"); you don't need the banker part in there

     

    As for banking you can just do getBank.DepositAllItems(); and it will just dump the entire inventory insteal of Bank.interact("Deposit");

     

    Also the complile have you set it up as an artifact and then added the module output to that? (What IDE do you use)

     

     

     

     

     

    As far as copying the cabbage picker script I wouldn't paste it I would follow it through and make a cabbage picking script instead, you also need to read through the script and make sure it's all right where I mentioned "Pick" that would be from the cabbage script that you need to change to "Take", also Ashes would be a ground object since they are on the ground as a pose to cabbage which would be a game object. Good luck ask if you need any more help

    Edited by triblion
    Link to comment
    Share on other sites

    i've already followed that java clas....

     

    Are you using an IDE to make the program? (Something like Eclipse or IntelliJ)

     

    If not, you should. They will help you out a lot when you're beginning. For example,

     

    QaKeeEQ.png

     

    This bracket that is underlined is closing your class already. Your variables aren't defined correctly "area" for the class that they are and "GameObject = Bank" / "GameObject = Ashes" both are not valid.

    Link to comment
    Share on other sites

    i am using IntelliJ

     

    ah now i see where i went wrong.

    i think i will stick to a woodcutter and after that progress to something else.

    Follow a video tutorial that will help a lot

    this is a troll right

    Everyone has to start somewhere

    Link to comment
    Share on other sites

    hello there,

     

    so i just tried tomake my first script for picking up ashes at the GE,

     

    ive copied the cabage picker script and tried to implement some things of my own,

    i know it is shit but dont be to hard on me :/

     

    ashes on the ground would be groundItems not gameobjects, most likely the action would be to Pick-up not just pick.

     

    you do no need to define a banker to be able to bank but if you choose to do so, they are an NPC not a gameObject, unless you want to interact with the bank booth.

     

    generally you would say if in certain distance to bank. getBank().open()

    Edited by none
    Link to comment
    Share on other sites

    ashes on the ground would be groundobjects not gameobjects, most likely the action would be to Pick-up not just pick.

     

    you do no need to define a banker to be able to bank but if you choose to do so, they are an NPC not a gameObject, unless you want to interact with the bank booth.

     

    generally you would say if in certain distance to bank. getBank().open()

     

    GroundItem* but yeah just do everything none says.

    Link to comment
    Share on other sites

     Share

    ×
    ×
    • 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.