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

Question How to smelt X ore at furnace

Discussion in 'Developer Support' started by halcynthis, Jun 14, 2016.

  1. halcynthis

    Joined:
    May 4, 2016
    Messages:
    3
    Likes Received:
    0
    I've decided to start with a simple smelting bot to start with learning the runemate API and I can't seem to find out how to select the smelt X option. Any help would be appreciated.

    GameObject furnace = GameObjects.newQuery().names("Furnace").results().nearest();
    if(Interfaces.newQuery().textContains("Bronze").results().first() == null) //Checking if furnace is selected, not sure if this is most efficient
    {
    furnace.interact("Smelt");
    }
    else
    {
    Interfaces.newQuery().textContains("Bronze").results().first().interact("Smelt -> 28");
    }
     
  2. Serene

    Serene ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    You can get the interface index with the developer kit which could make it easier. Use the filter area to find a certain text and find the actions within them to make sure it is the InterfaceComponent you're looking for, and the getAt() is the specific InterfaceComponent index you're looking for.

    With that you can do
    if (Interfaces.getAt() == null) { //searching for the smelting interface; if the interface is null
    furnace.interact("Smelt");
    } else if (Interfaces.getAt().isValid()) { //smelting interface isn't null. is it valid? if so, query for the bronze component and interact with it
    InterfaceComponent bronze = Interfaces.newQuery().getText("Bronze").results().first();
    if (bronze != null & bronze.isValid()){
    bronze.interact("Smelt 28"); //not sure if Smelt 28 is an action, but if not, do Smelt X and you can key in 28.
    }

    You could also replace the Interfaces.newQuery() search for Bronze with whatever you get from the DevKit as well, and can make it shorter searching for just the bronze InterfaceComponent.
     
    #2 Serene, Jun 14, 2016
    Last edited: Jun 14, 2016
  3. halcynthis

    Joined:
    May 4, 2016
    Messages:
    3
    Likes Received:
    0
    I swapped over to using getAt like you recommended and that appears to be working fine. I'm still having troubling getting the bot to actually click the button for bronze and select "Smelt X". At the moment it just keeps hovering over the bronze icon.

    if (bronze != null & bronze.isValid())
    {
    System.out.println("Attempting to smelt");
    bronze.interact("Smelt -> 28"); //I tried "Smelt 28" "Smelt X -> 28" here also
    }
     
  4. Serene

    Serene ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    Try "Smelt X" and then keying in the 28 using another method.
     
  5. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    "Smelt -> 28"
    "Smelt 28"
    "Smelt X -> 28"

    Where are you getting these strings from...............?
     
  6. halcynthis

    Joined:
    May 4, 2016
    Messages:
    3
    Likes Received:
    0
    I swear I had saw a post earlier when trying to find a solution to this problem that had something similar to them, perhaps doing this at 2am wasn't the brighest idea. Anyways I ended up going with the following;

    GameObject furnace = GameObjects.newQuery().names("Furnace").results().nearest();
    if (Interfaces.getAt(311, 16) == null)
    {
    furnace.interact("Smelt");
    }
    else if (Interfaces.getAt(311, 16).isValid())
    {
    InterfaceComponent bronze = Interfaces.newQuery().textContains("Bronze").results().first();
    InterfaceComponent amount = Interfaces.getAt(162, 32);
    if(bronze.isVisible() & !amount.isVisible())
    {
    if (bronze != null & bronze.isValid()) {

    System.out.println("Attempting to smelt");
    bronze.interact("Smelt X Bronze");
    }
    }
    else if(!bronze.isVisible() & amount.isVisible())
    {
    Keyboard.type("28", true);
    }
    }

    It still needs to check if the player is already smelting so it doesnt spam smelt, but I believe I'll be able to manage that. Figured I'd post the code just incase it helps someone in the future. Thanks for the help
     

Share This Page

Loading...