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
  • Scripting 101


    Hashtag

    Recommended Posts

    Hey im trying to get into scripting and have a couple of questions:

     

    How to get multiple tabs in the GUI like your #1 woodcutting script has for example,

     

    What would be the best way of traversing and depositing things at a bank,

     

    How to get camera and mouse movement to look human-like?

     

    Thats all, thanks.

    Hey,

     

    Multiple GUI tabs can be achieved with a JTabbedPane.

    JTabbedPane tabbedPane = new JTabbedPane();
    
    JPanel tab = new JPanel();
    tabbedPane.add("First tab", tab); // Can't remember whether the JPanel is first in the args
    
    tab = new JPanel();
    tabbedPane.add("Second tab", tab);
    
    getContentPane().add(tabbedPane);
    

    For walking, use getWalking().walk(tile);

    There's a class called Bank that contains all the methods you need for interacting with the bank when it's open. You access that class with the method getBank(). (For example: getBank().widthdraw("Coins", 100);)

     

    Making human-like camera/mouse movement is not as easy as you might think. However, you can play with the methods listed in the Camera and Mouse classes which you can access with the methods getCamera() and getMouse().

     

    I hope I managed to answer your questions. Good luck with scripting!

    Link to comment
    Share on other sites

    That was very useful thx,

     

    I have this code for my GUI

    dropCheckBox.addActionListener(e -> {if (dropCheckBox.isSelected()) {powerChop = true;} else {powerChop = false;}});
    

    How would i make another part of the GUI which is a combo box be refreshed to be blanked out if the variable powerChop is true?


    also: https://gyazo.com/693132a5b616fc1f71ff93a2dd3baa8f so you can see what im trying to do

     

    you tab thing worked like a charm

    Link to comment
    Share on other sites

    That was very useful thx,

     

    I have this code for my GUI

    dropCheckBox.addActionListener(e -> {if (dropCheckBox.isSelected()) {powerChop = true;} else {powerChop = false;}});
    

    How would i make another part of the GUI which is a combo box be refreshed to be blanked out if the variable powerChop is true?

    also: https://gyazo.com/693132a5b616fc1f71ff93a2dd3baa8f so you can see what im trying to do

     

    you tab thing worked like a charm

    Set its selected index by comboBox.setSelectedIndex(something);

    Link to comment
    Share on other sites

    • 1 month later...

    Is @Override really necessary? Doesn't it automatically knows it's overriding a method from the parent class?

    It's not necessary. However, for you it's more readable.

    Link to comment
    Share on other sites

    Hey there mate, great tutorial. Got me started using TaskScript and I'm finding it a lot easier than AbstractScript.

    My question is, in the GUI tutorial you have 

    if(isRunning = true) 

    in the onLoop of your script, however, TaskScript does not have an onLoop. This means that my GUI, effectively, does not work, as the script begins before I hit start - or, if I add this code to the onStart of TaskScript, nothing happens (as this is only ran once, when you start the script.) even when the button is pressed.

    Is there an alternative way to add a Start button to a TaskScript script?

    Thank you for your help!

     

     

    @Hashtag, do you know of any open-source TaskScript code so I can take a look? Thanks

     

    Here's a plank processing script I created using TaskScript. Github Gist

    Edited by iamreyne
    Link to comment
    Share on other sites

    Hey there mate, great tutorial. Got me started using TaskScript and I'm finding it a lot easier than AbstractScript.

     

    My question is, in the GUI tutorial you have 

    if(isRunning = true) 

    in the onLoop of your script, however, TaskScript does not have an onLoop. This means that my GUI, effectively, does not work, as the script begins before I hit start - or, if I add this code to the onStart of TaskScript, nothing happens (as this is only ran once, when you start the script.) even when the button is pressed.

     

    Is there an alternative way to add a Start button to a TaskScript script?

     

    Thank you for your help!

     

     

     

    Here's a plank processing script I created using TaskScript. Github Gist

    Hey, there are several approaches to this. You can have the button click event add the nodes instead of adding them in the onStart method. Another way is to have your nodes reference to the isRunning var and in the accept method return false if isRunning is false.

    Link to comment
    Share on other sites

    Hey, there are several approaches to this. You can have the button click event add the nodes instead of adding them in the onStart method. Another way is to have your nodes reference to the isRunning var and in the accept method return false if isRunning is false.

     

    Adding the nodes to the start button worked perfectly, thank you!

    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.