Hashtag 9069 Author Posted November 14, 2017 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!
templex 5 Posted November 14, 2017 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
Hashtag 9069 Author Posted November 14, 2017 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);
bob21 0 Posted December 23, 2017 Is @Override really necessary? Doesn't it automatically knows it's overriding a method from the parent class?
Hashtag 9069 Author Posted December 23, 2017 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.
bob21 0 Posted December 23, 2017 @Hashtag, do you know of any open-source TaskScript code so I can take a look? Thanks
Hashtag 9069 Author Posted December 23, 2017 @Hashtag, do you know of any open-source TaskScript code so I can take a look? Thanks Hey, sorry I don't know any nor do I have one.
iamreyne 4 Posted December 24, 2017 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
Hashtag 9069 Author Posted December 24, 2017 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.
iamreyne 4 Posted December 24, 2017 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!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.