Tutorial EmbeddableUI Tutorial/Reference

Discussion in 'Tutorials & Resources' started by proxi, Apr 6, 2016.

  1. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    454
    Likes Received:
    135
    Hello everyone!

    I've updated the example to now be a guiding reference in both TreeBot and EmbeddableUI. Both of these technologies are extremely useful and I'd highly suggest utilizing them both.

    I'll go over a summarization of TreeBot here...
    In TreeBot you essentially make a Binary tree of decisions. Below is a visual representation of the ExampleFlaxPicker bot.

    [​IMG]
    Note: This does not include the initial Root class that handles the waiting on GUI process. Please reference the Root class for more information on how the GUI process is handled.

    Each node can be a BranchTask, LeafTask, or TreeTask.

    You can think of each like so...
    LeafTask:
    - This is where the execution happens. The end of the tree.
    - If you reach a leaf task, all previous conditions should have been met and satisfied.
    - For example, in the above photo, pickFlaxLeaf should not be executed unless the inventory is not full, the bank is not open, and flax IS nearby. IF all of those were satisfied, the leaf task would get executed.

    BranchTask:
    - This is where the decisions are made. If this condition is met, branch this way, etc.
    - A branch task does not contain execution logic, only conditional.
    - Branch tasks are used to determine which leaf task should be executed.

    TreeTask:
    - I have not personally found a use for this one yet, but it is essentially a BranchTask that also has the ability to execute as a leaf. In other words, while the tree is being traversed, if it stumbles upon a TreeTask and that TreeTask is flagged as a leaf, it will run its 'execute' function and then proceed to run its 'validate' function and continue on down the tree.
    - I've found every situation to be completable with Leaf and Branch tasks.

    For those of you that are either new to RuneMate or transitioning from the RuneMate V1 to Spectre, you may find this thread interesting :)

    In RuneMate Spectre, a new standard for bots are being set. This standard is known as EmbeddableUI.

    EmbeddableUI is... essentially exactly what the name says. When creating your bot, one of your classes must implement 'EmbeddableUI', and by doing so, you will now have the opportunity to define and send a Node to the Spectre client referencing your Java FX GUI.

    And honestly... that's essentially it. Once the Node is set, the corresponding Java FX GUI will display embedded within the Spectre client!

    I know several questions will pop up. Please feel free to leave the question or comment below and we will try to get them answered.

    I've also attached a .zip file containing a simple Flax Picker bot that is Spectre-Ready. Please feel free to reference it!
     

    Attached Files:

    #1 proxi, Apr 6, 2016
    Last edited: Dec 28, 2016
  2. auxi

    Joined:
    May 24, 2016
    Messages:
    342
    Likes Received:
    103
    Helped me get my first EmbeddableUI working. Thanks a bunch for this.
     
  3. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    454
    Likes Received:
    135
    No problem! Glad I could help :)
     
  4. CodeNinja

    Joined:
    Dec 20, 2016
    Messages:
    8
    Likes Received:
    1
    Awesome resource, going to try and implement it in my own script bot.

    Question: does this actually create a paint over the game window, or is it just for the runemate client interface?

    Great job!
     
  5. Snufalufugus

    Joined:
    Aug 23, 2015
    Messages:
    103
    Likes Received:
    22
    It would be very nice if you added a second tree-bot version of the example code for people to reference. Could encourage people to use that format over loopingbot :)
     
  6. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    454
    Likes Received:
    135
    Good idea! :) I can convert this to treebot soon :)
     
    Snufalufugus likes this.
  7. Serene

    Serene Probably Juicing

    Joined:
    Mar 30, 2015
    Messages:
    462
    Likes Received:
    99
    Are you getting this from your EmbeddableUI?

    Code (Text):
    1. java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    This always points to loading my gui, and wasn't happening prior to the change from AbstractScript to AbstractBot. Weird.
     
  8. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    454
    Likes Received:
    135
    No sir, I'm not getting that. If the Only thing you changed was AbstractScript to AbstractBot, you may possibly want to bring that up to @Arbiter. I believe he's in charge of all UI related things with the client.
     
  9. awesome123man

    awesome123man Dawg -> Awesome

    Joined:
    Jan 31, 2016
    Messages:
    1,710
    Likes Received:
    400
    I believe this happens when onStart is run from the wrong thread (not from the bot thread i believe) which causes this. It doesnt happen every time correct? @SlashnHax i thought was gonna fix this... unless it's something else.
     
  10. Serene

    Serene Probably Juicing

    Joined:
    Mar 30, 2015
    Messages:
    462
    Likes Received:
    99
    I'm not calling onStart directly in any threads though. In dev mode, the error points to my GUI setup, specifically loading my inputstream, even though if I rerun the bot it'll load up my GUI no problem. Happens on almost all of my bots.

    The full code is
    Code (Text):
    1. java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    2.  at nul.iIiIiIiIiIiI.float(blb:158)
    3.  at com.runemate.game.api.hybrid.Environment.getBot(yqb:62)
    4.  at com.runemate.game.api.hybrid.GameEvents$GameEvent.isEnabled(lw:86)
    5.  at nul.iIIIIIiIiiIi.validate(whb:124)
    6.  at com.runemate.game.api.script.framework.LoopingBot.run(mxa:193)
    7.  at com.runemate.game.api.script.framework.AbstractBot.start(dza:163)
    8.  at nul.iiIiIIiiIIII.run(vib:99)
    9. RuneMate v2.4.4.4 - DivineFire v1.3.0 - OSRS r129 21CB29 - Windows 10 - Java8u92 x86 (Oracle Corporation)
     
  11. awesome123man

    awesome123man Dawg -> Awesome

    Joined:
    Jan 31, 2016
    Messages:
    1,710
    Likes Received:
    400
    Yep, happens to me as well.
     
  12. TheVTM

    Joined:
    Mar 29, 2016
    Messages:
    48
    Likes Received:
    7
    Is the TreeBot limited to a binary decision or could be more nodes?
     
  13. Savior

    Savior ArbiKool

    Joined:
    Nov 17, 2014
    Messages:
    1,970
    Likes Received:
    666
    It represents a binary tree. If you need a tree with more than two children per node, you can build one using the TaskBot framework.
     

Share This Page

Loading...