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 - Add a user interface to your bot

Joined
Jun 20, 2016
Messages
38
Worth adding, you'll need to add the .fxml file to the manifest as a resource if you plan on pushing this to SVN.

Totally possible this is in the video and I missed it, but this took me a bit of time to figure out.
 
Joined
Sep 21, 2015
Messages
22
Thanks, I spent a long while trying to figure this out until I saw this thread, I kept searching for threads about JavaFX and FXML so I overlooked this.
 
Joined
Sep 4, 2018
Messages
2
I tried this but i get error "input stream is null.". You never showed what code is in .fxml files. I maybe there is something i need?
 
Last edited:
Joined
Feb 9, 2019
Messages
44
Same as above.

Been trying to work through the pathing errors. I seem to be missing what the contents of your manifest file and the contents of your fxml file are. trying to follow similar local pathing for both on my windows machine using the forward slashes doesn't appear to work for me :(
 
Joined
Dec 29, 2018
Messages
18
I really do love your tutorial but you never showed the FXML file :( can you post your code on github for that or something so i can learn from it?
 
Joined
Jan 3, 2021
Messages
9
Worked for me in 2021. Started out with Tutorial - JavaFX for Beginners before merging that with this tutorial.

Don't forget to set your fx:id's in the SceneBuilder guys. That got me stuck for like 2 hours.

<manifest>
<main-class>com.cullington.bots.giantfrogslayer.GiantFrogSlayer</main-class>
<name>Giant Frog Slayer</name>
<tag-line>Kills giant frogs in the Lumbridge swamp.</tag-line><!--Max of 50 chars-->
<description>This bot will stay open-source and free because it's purpose is for new devs (like me) to see an example of a simple state machine bot implementation.
</description><!--Max of 110 chars-->
<version>1.0.0</version>
<compatibility>
<game>OSRS</game>
</compatibility>
<categories>
<category>COMBAT</category>
</categories>
<!--Required to publish on the bot store-->
<internal-id>GiantFrogSlayer</internal-id>
<!--The rest are optional-->
<open-source>true</open-source>
<hidden>false</hidden> <!--If you need to hide it from the bot store for maintenance-->
<access>public</access>
<tags>
<tag>Combat</tag>
<tag>Giant Frog</tag>
<tag>F2P</tag>
</tags>
<resources>
<resource>com/cullington/bots/giantfrogslayer/GiantFrogSlayer.fxml</resource>
<resource>com/cullington/bots/giantfrogslayer/images/newdevmeme.jpg</resource>
</resources>
</manifest>

package com.cullington.bots.giantfrogslayer;

import com.runemate.game.api.hybrid.util.Resources;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.CheckBox;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

import java.net.URL;
import java.util.Locale;
import java.util.ResourceBundle;

public class GiantFrogController implements Initializable
{
// region Declare fxml variables from SceneBuilder. REMINDER: DON'T FORGET TO SET fx:id IN SCENEBUILDER (Must be the same as the variable names here)

@FXML
private CheckBox checkBoxBigBones;

@FXML
private ImageView imageView;

// endregion

private final GiantFrogSlayer script;

@FXML
public void initialize(URL location, ResourceBundle resources)
{
Image newDevMemeImage = new Image(Resources.getAsStream("com/cullington/bots/giantfrogslayer/images/newdevmeme.jpg"));

imageView.setImage(newDevMemeImage);

// Handle the event inline else it doesn't work?
checkBoxBigBones.setOnAction(event ->
{
// Set the big bones boolean in the GiantFrogSlayer script
script.lootAndBuryBigBones = checkBoxBigBones.isSelected();

System.out.println("set lootAndBuryBigBones to " + script.lootAndBuryBigBones.toString().toUpperCase(Locale.ROOT));
});
}

public GiantFrogController(GiantFrogSlayer script)
{
this.script = script;
}
}

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Text?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="850.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<CheckBox fx:id="checkBoxBigBones" layoutX="16.0" layoutY="174.0" mnemonicParsing="false" text="Pick up and bury big bones" />
<Text layoutX="16.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="This bot will stay open-source and free because it's purpose is for new devs (like me) to see an example of a simple state machine bot implementation. &#10;&#10;NOTICE: Start the bot somewhere outside with no obstacles like doors in the way, preferably in the Giant frogs area. I have disabled web pathing to the Giant frogs because Runemates' default web pathing doesn't work atm.&#10;&#10;This bot kills giant frogs in the Lumbridge swamp. Supports strength potions. Supports Trout, Salmon and Tuna as food. Hops between F2P worlds when it gets crowded." wrappingWidth="480.0" />
<ImageView fx:id="imageView" fitHeight="596.0" fitWidth="480.0" layoutX="16.0" layoutY="228.0" pickOnBounds="true" preserveRatio="true" />
</children>
</AnchorPane>
 
Top