1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question Dropping items via inventory

Discussion in 'Developer Support' started by lollybot, May 4, 2016.

  1. lollybot

    Joined:
    Apr 30, 2016
    Messages:
    4
    Likes Received:
    0
    Code (Text):
    1. for (SpriteItem i : Inventory.getItems("Iron ore")) {
    2.  
    3.             Execution.delay(1000, 1500);
    4.             i.interact("Drop");
    5.         }
    6.         if(Inventory.contains("Iron ore"))
    7.             dropOre();
    I'm making a simple powerminer (Just trying to learn how to make bots), and I'm attempting to drop items from the inventory when full. The above works but it often misses items in the inventory hence why I attempted recursion, is there a better way to do it? Right now it looks clumsy.
     
  2. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Only drop one item per loop, or generally speaking, only do one action (interacting, turning camera, etc) per loop.
     
    lollybot likes this.

Share This Page

Loading...