Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • How to pass a variable to GUI


    Recommended Posts

    I'm hoping there's a solution for my issue.

    I have a woodcutter script with a GUI selection for the tree type, and I want the GUI to display the best tree based on woodcutting skill level. I wrote the code to get the best tree and it works fine. I can set the GUI display using 


    and that works fine. But when I use the variable 'bestTree' instead of "Oak", the GUI always shows null. I'm guessing that the GUI executes before onStart which is where I compute the best tree. I tried adding a long sleep in the GUI but that simply stopped everything for a minute and the GUI was still null when the script resumed.

    I'm out of ideas. Does anyone have any suggestions that I can try? 

    Link to comment
    Share on other sites

    You might need to post some more code for us to help you out, your not assigning bestTree to anything in that snippet, you will need to do something like bestTree = (string) comboBox.getSelectedItem() to set the variable before using it

    Link to comment
    Share on other sites

    @TheCloakedOne, thanks for the response. You helped me get past my null problem i.e. I has bad code for the 'bestTree' setter as you suggested. 

    My GUI no longer shows as blank, but it now shows "Tree" as the default (it's the first item in my array) instead of taking "Maple" from my bestTree variable. I'll play with the code some more now and see if I can fix it myself. If not, I may come back with my code and seek more help... thanks again.

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.