Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

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

Joined
Aug 23, 2015
Messages
1,961
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.
 
Community Manager
Joined
Apr 7, 2015
Messages
1,394
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.
 
The Pip Collector
Joined
Sep 14, 2014
Messages
445
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.
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.

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:
ChatDialog.option makeX = ChatDialog.getOption("Make-X");
if(makeX != null && makeX.isVisible()) {
    if(makeX.select(true)) {
        Execution.delayUntil(() -> {
            ChatDialog.Option option = ChatDialog.getOption(("Make-X");
             return (option == null || !option.isVisible());
         },  1800, 2400);
    }
}
 
The Pip Collector
Joined
Sep 14, 2014
Messages
445
I kindly even said don't quote me on this :<
3518.jpg
 
Joined
Sep 25, 2016
Messages
8
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:
ChatDialog.option makeX = ChatDialog.getOption("Make-X");
if(makeX != null && makeX.isVisible()) {
    if(makeX.select(true)) {
        Execution.delayUntil(() -> {
            ChatDialog.Option option = ChatDialog.getOption(("Make-X");
             return (option == null || !option.isVisible());
         },  1800, 2400);
    }
}

You solved this already, but I'm just going to throw in my two cents as well.

Java:
public void selectOption() {
    getOption("Make-X").ifPresent(interfaceComponent -> {
        if (interfaceComponent.isVisible() && interfaceComponent.click()) {
            Execution.delayUntil(() -> (interfaceComponent == null || !interfaceComponent.isVisible()), 300, 800);
        }
    });
}

public Optional<InterfaceComponent> getOption(String makeOption) {
    InterfaceComponent component = Interfaces.newQuery().textContains(makeOption).visible().results().first();
    return Optional.ofNullable(component);
}
 
Top