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

Question How to get items onto the Action bar?

Discussion in 'Developer Support' started by youramazingames, Jun 7, 2017.

Tags:
  1. youramazingames

    Joined:
    Oct 24, 2015
    Messages:
    79
    Likes Received:
    13
    What is the best way to get an item that is currently in your inventory onto the action bar?

    This is useful for power-mining and fishing.

    I cant seem to find a way to get it to do it, ether automatically or work out a way to get the client to drag the item.

    Thanks.
     
  2. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
  3. youramazingames

    Joined:
    Oct 24, 2015
    Messages:
    79
    Likes Received:
    13
    I did and there is very little information about getting an item on to the action bar. At the moment i have my bot working fine if you manually do it. But i would like it so the bot will do it.
     
  4. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    So how do you bring things into the actionbar yourself?
     
  5. youramazingames

    Joined:
    Oct 24, 2015
    Messages:
    79
    Likes Received:
    13
    Yeah that is what im asking.
     
  6. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    ... you drag things into the action bar
     
  7. youramazingames

    Joined:
    Oct 24, 2015
    Messages:
    79
    Likes Received:
    13
    no get the bot to do it not yourself... That is what im asking.
     
  8. Snufalufugus

    Joined:
    Aug 23, 2015
    Messages:
    1,961
    Likes Received:
    757
    Find API calls to mimic the steps you take you put an item there.

    -Move mouse to the item
    -Press and hold left mouse button
    -Find an open actionbar slot
    -Drag the item to it
    -Release the button

    The Jdocs have calls to help you with each step, and if you look around a bit you may find something to make the coding easier.
     
  9. sickness0666

    Joined:
    Mar 14, 2017
    Messages:
    156
    Likes Received:
    48
    Get the interactable bounds for the slot and the item in your inventory, then feed them into mouse.drag
     
  10. youramazingames

    Joined:
    Oct 24, 2015
    Messages:
    79
    Likes Received:
    13
    Yeah thats basilica what i did!

    Code (Text):
    1. ActionBarQueryResults a = ActionBar.newQuery().empty(true).results();
    2. SpriteItem b = Inventory.newQuery().names("Raw catfish").results().first();
    3. Mouse.drag(b.getInteractionPoint(), a.get(0).getInteractionPoint());
    4. Execution.delayUntil(() -> !Mouse.isMoving(), 1000, 4000);
    5. Execution.delay(500,3000);
    That works for me i guess.

    BTW i think ActionBar.newQuery().empty(true).results() is fucked as even if there are spaces that are not empty they will be in that list. Unless im miss understanding the .empty(true) thing.

    Maybe a bug.
     
    #10 youramazingames, Jun 7, 2017
    Last edited: Jun 7, 2017
  11. sickness0666

    Joined:
    Mar 14, 2017
    Messages:
    156
    Likes Received:
    48
    Filled is default to true, so you will need to add in a .filled(false) to your wuery
     
  12. youramazingames

    Joined:
    Oct 24, 2015
    Messages:
    79
    Likes Received:
    13
    Ok this is weird, This is how my current bar is set up (http://i.imgur.com/i6HThx2.png) [​IMG]
    and when i do
    Code (Text):
    1. ActionBarQueryResults a = ActionBar.newQuery().filled(true).results();
    2. System.out.println(a);
    Results:
    And if i do:
    Code (Text):
    1. ActionBarQueryResults a = ActionBar.newQuery().filled(false).results();
    2. System.out.println(a);
    Results:

    Any ideas?
     
  13. sickness0666

    Joined:
    Mar 14, 2017
    Messages:
    156
    Likes Received:
    48
    Empty is default to false, filled is default to true.

    So you will need both filled(false).empty(true)
     
    youramazingames likes this.
  14. youramazingames

    Joined:
    Oct 24, 2015
    Messages:
    79
    Likes Received:
    13
    thank you i got it working!!

    Cheers
     

Share This Page

Loading...