Question Interfaces.

Discussion in 'Developer Support' started by Constantijn Floris, Oct 5, 2016.

  1. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    I've been browsing around the forums looking for an answer but nothing did really help, it's about this code:

    Code (Text):
    1. final InterfaceComponent smithInterface = Interfaces.newQuery().containers(1371).actions("Close").results().first();
    2. if (smithInterface != null) {
    3.     System.out.println(smithInterface.getName());
    4.     System.out.println("Test: " + smithInterface);
    5.     smithInterface.click();
    6.     return State.closeSmithing;
    7. }
    I made a combat bot and it sometimes missclicks on a furnance, I want a way to let him find the interface, and if it's active it should close it, and return to combat.

    Thanks in advance!
     
  2. auxi

    Joined:
    May 24, 2016
    Messages:
    697
    Likes Received:
    272
  3. Gengsta

    Gengsta The Meme Outlet

    Joined:
    Apr 7, 2015
    Messages:
    724
    Likes Received:
    326
    Do you just want to close the interface if it misclicks on it?
     
  4. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    2,962
    Likes Received:
    874
    For rs3, you could use the MakeXInterface class to check if it's open and close it. Since that's the interface in this case.
     
    #4 SlashnHax, Oct 5, 2016
    Last edited: Oct 5, 2016
  5. Gengsta

    Gengsta The Meme Outlet

    Joined:
    Apr 7, 2015
    Messages:
    724
    Likes Received:
    326
    Couldn't you have let me answer the one question I could have? damnit slash
     
  6. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    Yes, I want it to close it.

    Can you show me an example?
     
  7. Gengsta

    Gengsta The Meme Outlet

    Joined:
    Apr 7, 2015
    Messages:
    724
    Likes Received:
    326
    Code (Text):
    1. if (MakeXInterface.isOpen()) {
    2.   MakeXInterface.close();
    3. }
    Some shit like that, I am not at my computer though so I can't test if it's correct. Might be missing semicolons etc
     
    #7 Gengsta, Oct 5, 2016
    Last edited: Oct 5, 2016
  8. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    I adjusted it a bit, missed one ) and a semicolons, and now it works. Thanks gee!
     
  9. Gengsta

    Gengsta The Meme Outlet

    Joined:
    Apr 7, 2015
    Messages:
    724
    Likes Received:
    326
    Gl with your bot m8 :>
     

Share This Page

Loading...