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

Question Interfaces.

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

  1. Remco1337

    Joined:
    Nov 6, 2015
    Messages:
    506
    Likes Received:
    11
    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:
    1,113
    Likes Received:
    990
  3. Gengsta

    Gengsta Community Manager

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

    Joined:
    Dec 10, 2014
    Messages:
    3,212
    Likes Received:
    1,042
    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 Community Manager

    Joined:
    Apr 7, 2015
    Messages:
    1,392
    Likes Received:
    763
    Couldn't you have let me answer the one question I could have? damnit slash
     
  6. Remco1337

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

    Can you show me an example?
     
  7. Gengsta

    Gengsta Community Manager

    Joined:
    Apr 7, 2015
    Messages:
    1,392
    Likes Received:
    763
    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. Remco1337

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

    Gengsta Community Manager

    Joined:
    Apr 7, 2015
    Messages:
    1,392
    Likes Received:
    763
    Gl with your bot m8 :>
     

Share This Page

Loading...