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

Tutorial Implementing Embeddable UI - Add a user interface to your bot

Discussion in 'Tutorials & Resources' started by SlashnHax, Apr 7, 2016.

  1. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
  2. proxi

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

    Joined:
    Aug 23, 2015
    Messages:
    2,222
    Likes Received:
    501
    This video is sexy. Your voice is sexy. You is sexy <3
     
    LucasSousa likes this.
  3. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    Fantastic tutorial. I couldn't have done it better myself.
     
  4. ColtKappa

    Joined:
    Jun 20, 2016
    Messages:
    38
    Likes Received:
    16
    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.
     
    Fabreze likes this.
  5. A Savage

    A Savage The Führer

    Joined:
    Feb 6, 2017
    Messages:
    237
    Likes Received:
    149
    That sexy voice, totally didn't fap. Thanks for video, really needed it.
     
  6. NullString

    Joined:
    Sep 21, 2015
    Messages:
    22
    Likes Received:
    0
    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.
     
  7. haskabab

    Joined:
    Nov 21, 2017
    Messages:
    16
    Likes Received:
    2
    Nice video, thanks for sharing.
     
  8. DM18

    Joined:
    Oct 23, 2017
    Messages:
    1
    Likes Received:
    0
    How can I turn off the NPC dismisser? I like the NPC Random Events.
     
  9. Vil4nte

    Joined:
    Sep 4, 2018
    Messages:
    2
    Likes Received:
    1
    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?
     
    #9 Vil4nte, Sep 12, 2018
    Last edited: Sep 12, 2018
    CoreBot likes this.
  10. lb25

    Joined:
    Feb 9, 2019
    Messages:
    44
    Likes Received:
    3
    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 :(
     
    CoreBot likes this.
  11. guydatpwnz

    Joined:
    Dec 29, 2018
    Messages:
    18
    Likes Received:
    1
    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?
     
  12. Rumb

    Joined:
    Jan 3, 2021
    Messages:
    9
    Likes Received:
    6
    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 bot;

    @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 bot
    script bot.lootAndBuryBigBones = checkBoxBigBones.isSelected();

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

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

    <?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>
     
    bobbyd323 and proxi like this.

Share This Page

Loading...