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
  • Using ID's instead of GameObject Name


    Kirito
     Share

    Recommended Posts

    so i'm making a script for item collecting but the game object has 2 items that you can collect but if i use the regular GameObject name then it spam clicks it even if there are no items on it. how would i make it collect the items untill there are no more and change GameObject or swap world?

    Link to comment
    Share on other sites

    You could get the gameobject\grounditem and check it with .exists() or you just get all gameobjects/grounditems and check if the object/item exists in the list/array.

    Link to comment
    Share on other sites

    You could get the gameobject\grounditem and check it with .exists() or you just get all gameobjects/grounditems and check if the object/item exists in the list/array.

    ok so i currently have this

     

     

    private State getState() {
    GameObject tree = getGameObjects().closest("Banana Tree");
    if (getInventory().isFull())
    return State.BANK;
    if (tree != null)
    return State.PICK;
    return State.WAIT;
    }
     
    public void onExit() {
    log("Thank you for using Banana Picker by Kirito.");
    }
     
    @Override
    public int onLoop() {
    switch (getState()) {
    case PICK:
    GameObject tree = getGameObjects().closest("Panana Tree");
    if (tree != null && getLocalPlayer().isStandingStill()) {
    log("Status: Picking all Banana's");
    tree.interact("Pick-from");
    //return Calculations.random(500, 600);
    }
    Link to comment
    Share on other sites

    Panana != Banana

     

    The Banana tree should have a different model id if the Bananas are picked. You could check for that or if the action pick-from is available.

    Edited by Soldtodie
    Link to comment
    Share on other sites

    Panana != Banana

     

    The Banana tree should have a different model id if the Bananas are picked. You could check for that or if the action pick-from is available.

    the banana tree was just an example so i tried it with red berry bush's but there the pick option stays up for some reason and then it keeps spam clicking that single bush even tough the berries are not there

     

     

    got this now

     

    GameObject bush = getGameObjects().closest(cadava -> cadava.getID() == 23625);

     

    but now i need to be able to add multiple ids

    Edited by Kirito
    Link to comment
    Share on other sites

    Well I'm not sure if you can obtain how many are items are left on the tree/plant but all bushes have 3 berries, I think all fruit trees are 6 fruit. So you can count how many you pick and stop picking once you reach that number.

    Link to comment
    Share on other sites

    Well I'm not sure if you can obtain how many are items are left on the tree/plant but all bushes have 3 berries, I think all fruit trees are 6 fruit. So you can count how many you pick and stop picking once you reach that number.

    every fruit you pick makes the bush/tree id change by 1 for example cadava berries = id 23625 when having 2 berries 1 berry picked = 23626 all berries picked = 23627.

    the problem is when the bot picks 1 fruit the GameObject id changes wich results in not picking fruits anymore.

    Link to comment
    Share on other sites

    every fruit you pick makes the bush/tree id change by 1 for example cadava berries = id 23625 when having 2 berries 1 berry picked = 23626 all berries picked = 23627.

    the problem is when the bot picks 1 fruit the GameObject id changes wich results in not picking fruits anymore.

    Oh, then do this.

     

    GameObject bushWithBerries = getGameObjects().closest(cadava -> cadava.getID() == 23625 || cadava.getID() == 23626 || cadava.getID() == idWhenNoBerriesArePicked);

    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.