Question 2 small questions.

Discussion in 'Developer Support' started by Constantijn Floris, Nov 10, 2015.

  1. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    Hello, I am new to RuneMate but I did some coding for other bots, I will work my way here too.

    I am starting on a Cooker which works at the GE.

    2 things seem to not be working for now,

    #1

    Code (Text):
    1. } else if (fire.interact("Use")) {
    2.                         Execution.delayUntil(() -> !Inventory.contains(troutID), 5000);
    3.                     }
    It says Lambda expressions are not supported at this language level.

    On this line: () -> !Inventory.contains(troutID)

    2#

    How can I handle these dialogs which popup?

    I have been looking through the Docs but I can't seem to find it, if you give me the name I can do the other research myself!

    [​IMG]

    Thanks in advance!
     
  2. Defeat3d

    Defeat3d Celestial

    Joined:
    Oct 30, 2014
    Messages:
    1,142
    Likes Received:
    486
    Go to your project settings and set the language level to 8.

    You have to use interfaces to handle those dialogs, you can find their data using the SDK.
     
  3. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    Could you show me an example with how you handle interfaces? It's kinda though.
     
  4. Defeat3d

    Defeat3d Celestial

    Joined:
    Oct 30, 2014
    Messages:
    1,142
    Likes Received:
    486
    Query the interface you need using your collected data, for example:
    Code (Text):
    1. final InterfaceComponent button = Interfaces.newQuery().names("Dank meme").actions("Blaze").visible().results().first();

    Then you can use that component just like any other interactable.
     
  5. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    Where can I find the inferface names? When I open the Developer tool it's hard to see which interface is doing what.

    Edit: And how can I change this? [Caution] GE Cooker is using the default loop delay of [200,400].
     
    #5 Constantijn Floris, Nov 10, 2015
    Last edited: Nov 10, 2015
  6. Defeat3d

    Defeat3d Celestial

    Joined:
    Oct 30, 2014
    Messages:
    1,142
    Likes Received:
    486
    setLoopDelay()
     
  7. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    Thanks so far!

    I have been really getting along, only this is still not working:

    Code (Text):
    1. final InterfaceComponent cookInterface = Interfaces.newQuery().containers(1179).results().first();
    2.                         if (cookInterface != null) {
    3.                             System.out.println("Test");
    4.                             cookInterface.click(); //interact() if you know the action
    5.                         }
    Yes, 1179 is the correct container!
     
  8. Defeat3d

    Defeat3d Celestial

    Joined:
    Oct 30, 2014
    Messages:
    1,142
    Likes Received:
    486
    A container usually contains multiple components and you're simply picking the first in it, which might not be the one you need. It's not recommended to use the container ids, but rather names, actions, or even dimensions.
     
  9. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    Okay so I tried it by name:

    [​IMG]

    Code (Text):
    1. final InterfaceComponent cookInterface = Interfaces.newQuery().textContains("Cook").results().first();
    2.             if (cookInterface != null) {
    3.                 System.out.println("Cook dialog opened");
    4.                 if(cookInterface.interact("Cook"))
    5.                 {
    6.                     System.out.println("Cook was clicked");
    7.                 }
    8.                 else
    9.                 {
    10.                     System.out.println("Cook wasn't clicked");
    11.                 }
    12.             }
    Code (Text):
    1. (10:31:19) Trout found! Looking for a fire!
    2. (10:31:19) Cook dialog opened
    3. (10:31:20) Cook wasn't clicked
    Still hasn't clicked it.

    EDIT:

    If I change .interact with .click() it says it's clicked but he hasn't clicked it.
     
    #9 Constantijn Floris, Nov 10, 2015
    Last edited: Nov 10, 2015
  10. Defeat3d

    Defeat3d Celestial

    Joined:
    Oct 30, 2014
    Messages:
    1,142
    Likes Received:
    486
    The contained item of the interface contains the text "Cook", not the interface itself.
     
  11. Constantijn Floris

    Joined:
    Nov 6, 2015
    Messages:
    13
    Likes Received:
    1
    Could you please put down 1 good example?

    I have been struggeling with this for the entire day.
    --- Double Post Merged, Nov 11, 2015, Original Post Date: Nov 10, 2015 ---
    Close this moved on a new project!
     

Share This Page

Loading...