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
  • Need help (script)


    maxime

    Recommended Posts

    hi i am looking to make Area i know people will just comment (Area tree = new Area();)

    I need to make Area for Each Tree

    Tree area
    Oak area 
    ect..

    in only 1 script with Gui 

    when you select example : Yew it will go to the Yew Area , Tree to the TreeArea , Oak to the OakArea

    Thanks for helping.

    Link to comment
    Share on other sites

    The way to do this (atleast how I do) is by making 3 classes:

     

    1. The main class for the script (main)

    2. The GUI class for the script (gui)

    3. A class to pass the variables from the gui into the script (scriptvars)

     

    Make the GUI take a variable of the scriptvars class in the constructor:

    public gui(ScriptVars sv){
        public String selectedArea
    }
    

    When pressing the "Start" button in your script, pass the selected value in the GUI into a field in the scriptvars class:

    startButton.addActionListener(new ActionListener() {
    sv.selectedArea = comboBox.getSelectedItem().ToString();
    }
    

    In your mainclass, initialise the GUI and Scriptvars class as follows:

    public void onStart(){
        	sv = new ScriptVars();
        	gui = new GUI(sv);
        	gui.setVisible(true);
        	while(gui.isVisible()){
        		sleep(10,30);
        	}
        }
    

    I hope this helps. If it's too confusing, let me know.

    Link to comment
    Share on other sites

    The way to do this (atleast how I do) is by making 3 classes:

     

    1. The main class for the script (main)

    2. The GUI class for the script (gui)

    3. A class to pass the variables from the gui into the script (scriptvars)

     

    Make the GUI take a variable of the scriptvars class in the constructor:

    public gui(ScriptVars sv){
        public String selectedArea
    }
    

    When pressing the "Start" button in your script, pass the selected value in the GUI into a field in the scriptvars class:

    startButton.addActionListener(new ActionListener() {
    sv.selectedArea = comboBox.getSelectedItem().ToString();
    }
    

    In your mainclass, initialise the GUI and Scriptvars class as follows:

    public void onStart(){
        	sv = new ScriptVars();
        	gui = new GUI(sv);
        	gui.setVisible(true);
        	while(gui.isVisible()){
        		sleep(10,30);
        	}
        }
    

    I hope this helps. If it's too confusing, let me know.

    send you a pm 

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.