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 Implementing Embeddable UI

12 year old normie
Joined
Jan 8, 2015
Messages
2,768
Thanks mayte, I will take a look at it as soon as I get home.
 
Joined
Nov 2, 2015
Messages
302
Great video.

Any chance you could make a #2 that demonstrates the a gui controller for EmbeddableUI that has a few config buttons and a bot status update ?
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,053
Great video.

Any chance you could make a #2 that demonstrates the a gui controller for EmbeddableUI that has a few config buttons and a bot status update ?
There is nothing RuneMate specific about the JavaFX controller. You should be able to find plenty of tutorials online on how to set up and use JavaFX controllers online.
 
First Bot Author
Joined
Aug 7, 2013
Messages
262
Great video.

Any chance you could make a #2 that demonstrates the a gui controller for EmbeddableUI that has a few config buttons and a bot status update ?
There is nothing RuneMate specific about the JavaFX controller. You should be able to find plenty of tutorials online on how to set up and use JavaFX controllers online.
Scene Builder can also generate a controller for your design.
 
Joined
Nov 2, 2015
Messages
302
I followed the video and got this error
Gyazo - 9fec431ad6da5e31e016d0e2e15dc08c.png

I'm assuming its because my controller was made without embeddableUI in mind.

EDIT: I got my controller working now. But would be nice to know how to do all that spiffy stuff like show profit /xp now that there is no paint. Or even a status
 
Last edited:
First Bot Author
Joined
Aug 7, 2013
Messages
262
Why is botInterfaceProperty never called? I do see the UI in Spectre, but that's about it.
Java:
package com.skelware.runemate.script.staking;

import com.runemate.game.api.client.embeddable.EmbeddableUI;
import com.runemate.game.api.hybrid.util.Resources;
import com.runemate.game.api.script.framework.LoopingScript;
import com.skelware.runemate.script.staking.ui.UIController;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;

import java.io.IOException;
import java.io.InputStream;

public class StakingSalvation extends LoopingScript implements EmbeddableUI {

    private ObjectProperty<? extends Node> ui;

    public StakingSalvation() {
        this.setEmbeddableUI(this);
    }

    @Override
    public void onLoop() {

    }

    @Override
    public void onStop() {
        System.out.println("stop");
    }

    @Override
    public ObjectProperty<? extends Node> botInterfaceProperty() {
        System.out.println("botInterfaceProperty");

        if (ui == null) {
            try {
                final FXMLLoader loader = new FXMLLoader();
                final InputStream input = Resources.getAsStream("com/skelware/runemate/script/staking/ui/UIDocument.fxml");
                final Parent document = loader.load(input);

                loader.setController(new UIController());
                ui = new SimpleObjectProperty<>(document);
            } catch (final IOException e) {
                e.printStackTrace();
            }
        }

        return ui;
    }
}
 
First Bot Author
Joined
Aug 7, 2013
Messages
262
If you can see it, the method must have been called.
Well system out did not log anything to the console, but the "stop" is logged to the console. So it most definitely is not called, unless system out is suppressed at certain stages, @Cloud?
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
Well system out did not log anything to the console, but the "stop" is logged to the console. So it most definitely is not called, unless system out is suppressed at certain stages, @Cloud?
What else would load the fxml then? Welp I know nothing further so I will leave this here :rolleyes:
 
First Bot Author
Joined
Aug 7, 2013
Messages
262
What else would load the fxml then? Welp I know nothing further so I will leave this here :rolleyes:
Yeah it just seems like system out is not passed through. If I create a deliberate error in my controller's constructor it logs the error correctly with the expected stack trace.
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,416
When I first tried the tutorial, I had the same problem as this Gyazo - 9fec431ad6da5e31e016d0e2e15dc08c.png, since my controller is looking for a botand stage to be passed in. Probably because it wasn't made with EmbeddableUI in mind. I changed the constructor on that to not require those and not pass in or set a script & stage (not sure if that was the right thing to do but all errors cleared) and now when I run the bot my UI doesn't pop up and I run into

Code:
javafx.fxml.LoadException:
unknown path

   at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)
   at com.deathizpro.bots.EmbeddableUITutorial.EmbeddableUITutorial.botInterfaceProperty(EmbeddableUITutorial.java:28)
   at nul.iIIiiIiIIIii.initialize(nvb:233)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
   at nul.IiiIIiiiiiii.try(gp:140)
   at nul.IiiIIiiiiiii.try(gp:146)
   at nul.iIIiiIiIIIii.<init>(nvb:150)
   at nul.iIiiIIiIIIiI.try(vgc:78)
   at nul.IIIiIIiIIiii.try(bub:1)
   at nul.IiIiiIiiIiiI.try(ltb:17782)
   at nul.IiIiiIiiIiiI.call(ltb:1177)
   at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
   at com.deathizpro.bots.EmbeddableUITutorial.TestUIController.initialize(TestUIController.java:21)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
   ... 16 more

which is the same problem I have here Question - javafx.fxml.LoadException: unknown path
 
Client Developer
Joined
Oct 12, 2015
Messages
3,781
When I first tried the tutorial, I had the same problem as this Gyazo - 9fec431ad6da5e31e016d0e2e15dc08c.png, since my controller is looking for a botand stage to be passed in. Probably because it wasn't made with EmbeddableUI in mind. I changed the constructor on that to not require those and not pass in or set a script & stage (not sure if that was the right thing to do but all errors cleared) and now when I run the bot my UI doesn't pop up and I run into

Code:
javafx.fxml.LoadException:
unknown path

   at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)
   at com.deathizpro.bots.EmbeddableUITutorial.EmbeddableUITutorial.botInterfaceProperty(EmbeddableUITutorial.java:28)
   at nul.iIIiiIiIIIii.initialize(nvb:233)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
   at nul.IiiIIiiiiiii.try(gp:140)
   at nul.IiiIIiiiiiii.try(gp:146)
   at nul.iIIiiIiIIIii.<init>(nvb:150)
   at nul.iIiiIIiIIIiI.try(vgc:78)
   at nul.IIIiIIiIIiii.try(bub:1)
   at nul.IiIiiIiiIiiI.try(ltb:17782)
   at nul.IiIiiIiiIiiI.call(ltb:1177)
   at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
   at com.deathizpro.bots.EmbeddableUITutorial.TestUIController.initialize(TestUIController.java:21)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
   ... 16 more

which is the same problem I have here Question - javafx.fxml.LoadException: unknown path

One or more of your FXML elements isn't properly declared, most likely.
 
Use this to make sure you're declaring all your elements.

JqQKbCB.png
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,416
One or more of your FXML elements isn't properly declared, most likely.
 
Use this to make sure you're declaring all your elements.

JqQKbCB.png

Should I be declaring the anchorpane and label as well? My Gui only has 1 label, 1 button, 1 combobox, and the anchorpane itself. Without the anchorpane and label declared my skeleton looks like

oNagRe2


And my controller class looks like

7Zx4HPq
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,053
Should I be declaring the anchorpane and label as well? My Gui only has 1 label, 1 button, 1 combobox, and the anchorpane itself. Without the anchorpane and label declared my skeleton looks like

oNagRe2


And my controller class looks like

7Zx4HPq
You're missing the @FXML annotations.
 
Top