Question How do I select make-# of an object in a chatbox interface?

Discussion in 'Developer Support' started by Snufalufugus, Oct 3, 2016.

  1. Snufalufugus

    Joined:
    Aug 23, 2015
    Messages:
    491
    Likes Received:
    226
    In my specific case I'm trying to select the "make-x" of a longbow after using a knife on a log, but this would be applicable to other things like cooking, herblore etc. Looking at the javadocs, nothing under the interfaces class jumps out at me, and the MakeXInterface class (the only other one that I think is applicable) is listed as RS3 only.
     
  2. Gengsta

    Gengsta The Meme Outlet

    Joined:
    Apr 7, 2015
    Messages:
    648
    Likes Received:
    282
    I am pretty sure the chatbox isn't an interface. I have a better feeling about ChatDialog or something in those lines, don't quote me on this though.
     
  3. Infinite Inferno

    Infinite Inferno The Pip Collector

    Joined:
    Sep 14, 2014
    Messages:
    429
    Likes Received:
    119
    Gengsta is partially correct. You can use the Interfaces class to get the Make-X component, however, as it is a ChatDialog, the ChatDialog class is the best use for this.
    Code (Text):
    1.  
    2. ChatDialog.option makeX = ChatDialog.getOption("Make-X");
    3. if(makeX != null && makeX.isVisible()) {
    4.     if(makeX.select(true)) {
    5.         Execution.delayUntil(() -> {
    6.             ChatDialog.Option option = ChatDialog.getOption(("Make-X");
    7.              return (option == null || !option.isVisible());
    8.          },  1800, 2400);
    9.     }
    10. }
    11.  
     
    Greg likes this.
  4. Gengsta

    Gengsta The Meme Outlet

    Joined:
    Apr 7, 2015
    Messages:
    648
    Likes Received:
    282
    I kindly even said don't quote me on this :<
     
    RobinPC likes this.
  5. Snufalufugus

    Joined:
    Aug 23, 2015
    Messages:
    491
    Likes Received:
    226
    Thank you both for the help
     
  6. Infinite Inferno

    Infinite Inferno The Pip Collector

    Joined:
    Sep 14, 2014
    Messages:
    429
    Likes Received:
    119
    [​IMG]
     
  7. Greg

    Joined:
    Sep 25, 2016
    Messages:
    8
    Likes Received:
    2
    You solved this already, but I'm just going to throw in my two cents as well.

    Code (Java):
    1.  
    2. public void selectOption() {
    3.     getOption("Make-X").ifPresent(interfaceComponent -> {
    4.         if (interfaceComponent.isVisible() && interfaceComponent.click()) {
    5.             Execution.delayUntil(() -> (interfaceComponent == null || !interfaceComponent.isVisible()), 300, 800);
    6.         }
    7.     });
    8. }
    9.  
    10. public Optional<InterfaceComponent> getOption(String makeOption) {
    11.     InterfaceComponent component = Interfaces.newQuery().textContains(makeOption).visible().results().first();
    12.     return Optional.ofNullable(component);
    13. }
    14.  
     

Share This Page

Loading...