Welcome!

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

Sign up now!

Tutorial EmbeddableUI & TreeBot Tutorial/Reference

s̶c̶r̶i̶p̶t̶ bot*
Joined
Aug 23, 2015
Messages
2,223
[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.

UkXCYim.png

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!
 

Attachments

  • exampleflaxpicker.zip
    17.4 KB · Views: 360
  • exampleflaxpicker 9-16-17.zip
    17.8 KB · Views: 493
Last edited:
Joined
Dec 20, 2016
Messages
37
Awesome resource, going to try and implement it in my own script.

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

Great job!
 
Joined
Aug 23, 2015
Messages
1,961
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 :)
 
s̶c̶r̶i̶p̶t̶ bot*
Joined
Aug 23, 2015
Messages
2,223
Awesome resource, going to try and implement it in my own script.

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

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.

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 :)

Good idea! :) I can convert this to treebot soon :)
 
Last edited:
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,410
Are you getting this from your EmbeddableUI?

Code:
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.
 
s̶c̶r̶i̶p̶t̶ bot*
Joined
Aug 23, 2015
Messages
2,223
Are you getting this from your EmbeddableUI?

Code:
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.

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.
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
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.
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.
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,410
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.

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:
java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
 at nul.iIiIiIiIiIiI.float(blb:158)
 at com.runemate.game.api.hybrid.Environment.getBot(yqb:62)
 at com.runemate.game.api.hybrid.GameEvents$GameEvent.isEnabled(lw:86)
 at nul.iIIIIIiIiiIi.validate(whb:124)
 at com.runemate.game.api.script.framework.LoopingBot.run(mxa:193)
 at com.runemate.game.api.script.framework.AbstractBot.start(dza:163)
 at nul.iiIiIIiiIIII.run(vib:99)
RuneMate v2.4.4.4 - DivineFire v1.3.0 - OSRS r129 21CB29 - Windows 10 - Java8u92 x86 (Oracle Corporation)
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
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:
java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
 at nul.iIiIiIiIiIiI.float(blb:158)
 at com.runemate.game.api.hybrid.Environment.getBot(yqb:62)
 at com.runemate.game.api.hybrid.GameEvents$GameEvent.isEnabled(lw:86)
 at nul.iIIIIIiIiiIi.validate(whb:124)
 at com.runemate.game.api.script.framework.LoopingBot.run(mxa:193)
 at com.runemate.game.api.script.framework.AbstractBot.start(dza:163)
 at nul.iiIiIIiiIIII.run(vib:99)
RuneMate v2.4.4.4 - DivineFire v1.3.0 - OSRS r129 21CB29 - Windows 10 - Java8u92 x86 (Oracle Corporation)
Yep, happens to me as well.
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
Is the TreeBot limited to a binary decision or could be more nodes?
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.
 
bored
Joined
Feb 11, 2017
Messages
21
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.
 
Joined
Jan 29, 2017
Messages
29
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.
 
Top