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

Tutorial EmbeddableUI & TreeBot 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:
    2,222
    Likes Received:
    501
    [Updated 9/16/17]
    - Updated to reflect more commonly used practices in TreeBot

    [Updated 3/22/17]
    - Fixed an issue with invalid stream path

    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.

    "exampleflaxpicker 9-16-17" is the newest download. The previous version is available just in case.

    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: Sep 16, 2017
    Mentits, Traz, urbex07 and 9 others like this.
  2. auxi

    Joined:
    May 24, 2016
    Messages:
    1,113
    Likes Received:
    990
    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:
    2,222
    Likes Received:
    501
    No problem! Glad I could help :)
     
  4. CodeNinja

    Joined:
    Dec 20, 2016
    Messages:
    37
    Likes Received:
    3
    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:
    1,961
    Likes Received:
    757
    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:
    2,222
    Likes Received:
    501
    This is for an embeddable UI in the RuneMate interface. You CAN do paint overlays in the game, however I believe it's not officially supported (I could be wrong about this). But @SlashnHax has a bot in the store, Open Interface Explorer, that's open source and utilizes paint overlay if you'd like to look into it. Iirc though, the bot won't get approved to be in the bot store unless its for development purposes if it has paint overlay.

    Good idea! :) I can convert this to treebot soon :)
     
    #6 proxi, Dec 23, 2016
    Last edited: Apr 6, 2017
    Snufalufugus likes this.
  7. Serene

    Serene ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    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:
    2,222
    Likes Received:
    501
    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 Go check out new bots and give helpful feedback.

    Joined:
    Jan 31, 2016
    Messages:
    5,413
    Likes Received:
    1,662
    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 ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    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 Go check out new bots and give helpful feedback.

    Joined:
    Jan 31, 2016
    Messages:
    5,413
    Likes Received:
    1,662
    Yep, happens to me as well.
     
  12. TheVTM

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

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    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.
     
  14. Glitch_

    Glitch_ bored

    Joined:
    Feb 11, 2017
    Messages:
    21
    Likes Received:
    6
    This is exactly what I was looking for. Thank you so much!
     
  15. steelmuffin

    Joined:
    Jul 9, 2015
    Messages:
    98
    Likes Received:
    36
    Explain pls
     
  16. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    What is there to explain? In TreeBot, your branch nodes have exactly 2 children. In TaskBot, the each task can have a list of children.
     
  17. chris121

    Joined:
    May 27, 2016
    Messages:
    745
    Likes Received:
    126
    i want to make children on intellij but cant implemet shit
     
  18. Glitch_

    Glitch_ bored

    Joined:
    Feb 11, 2017
    Messages:
    21
    Likes Received:
    6
    Hey it probably doesn't matter since this is just for reference, but the download you provided is missing the com.sudo.v3.spectre.statics package (includes the UpdateUI class).

    Hey just to update I re-read your thread again:

    "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."

    I'm guessing this is what you meant.
     
    timthestew and proxi like this.
  19. steelmuffin

    Joined:
    Jul 9, 2015
    Messages:
    98
    Likes Received:
    36
    Really? I had no idea.
     
  20. Ap0kalypsis

    Joined:
    Jan 29, 2017
    Messages:
    29
    Likes Received:
    2
    Can you branch off a leaf? Like say i called a leaf to teleport somewhere, now I want it to check if its near someplace to do something else.
     

Share This Page

Loading...