cbizz 1 Share Posted January 8, 2018 First and foremost thank you for the tutorial it was very helpful! I am confused on how I can get my JcomboBox trigger my bot to walk to a chosen area and how I could set up my loop to preform that action. I know I can do something like if (GE_AREA.contains(getLocalPlayer)); { } else ( if (getWalking().walk(GE_AREA.getRandomTile())) but how could I set it up so that it would check for the JcomboBox's String first so it knows what location? I appreciate any help! Link to comment Share on other sites More sharing options...
SummonerLit 0 Share Posted July 12, 2018 I've followed everything you've done for the GUI perfectly (aside from adding more options for the enemies), but when I build it I get the error that java ')' expected in place of -> in the button.addActionListener(1 -> { .... I am not sure why this is happening, and dont know how to resolve this issue. Still pretty new at all of this so maybe I've just missed something, any help is greatly appreciated. for reference this is exactly what I have down button.addActionListener(1 -> { foodName = foodNameTextField.getText(); //store inputted food name lootBones = lootCheckBox.isSelected(); /* our enemyComboBox was filled with strings but getselecteditem returns an object. This means we need to call .tostring() on the object to get the selected string. */ enemyName = enemyComboBox.getSelectedItem().toString(); isRunning = true; // now our script will start looping our code. frame.dispose(); //closes the GUI window }); Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted July 12, 2018 1 hour ago, SummonerLit said: I've followed everything you've done for the GUI perfectly (aside from adding more options for the enemies), but when I build it I get the error that java ')' expected in place of -> in the button.addActionListener(1 -> { .... I am not sure why this is happening, and dont know how to resolve this issue. Still pretty new at all of this so maybe I've just missed something, any help is greatly appreciated. for reference this is exactly what I have down button.addActionListener(1 -> { foodName = foodNameTextField.getText(); //store inputted food name lootBones = lootCheckBox.isSelected(); /* our enemyComboBox was filled with strings but getselecteditem returns an object. This means we need to call .tostring() on the object to get the selected string. */ enemyName = enemyComboBox.getSelectedItem().toString(); isRunning = true; // now our script will start looping our code. frame.dispose(); //closes the GUI window }); It's an L not a one. Link to comment Share on other sites More sharing options...
SummonerLit 0 Share Posted July 12, 2018 19 minutes ago, Milasoft said: It's an L not a one. Lol thank you, hard to tell the difference between the two. Link to comment Share on other sites More sharing options...
Coder777 1 Share Posted July 11, 2019 Thank you for the guide! @Hashtag Link to comment Share on other sites More sharing options...
DaffyDubz 4 Share Posted September 12, 2019 Very helpful tut, thank you. I have a question regarding abstract vs task. In task, is there no need to loop through each node in the onloop? Or just declaring then in start is enough? Im on mobile so I apologize if I missed it but your task code didn't appear to overwrite onloop. Also, currently in my first script, I'm using abstract but also nodes and running for each node in my onloop (checking the state of the script I've defined), is this ok? And is there a better way to pass my main class to the nodes than passing the whole class each time? Im using both public and private variables (private all have get set obviously) but just curious if there's a better practice than what I've currently done. It feels very sloppy to me lol but it's also pretty half-assed (some of my classes are very messy) and it's just a rs script so I'm not too worried because it works, but my OCD is killing me lol. Thanks again! Link to comment Share on other sites More sharing options...
m4rr3co 67 Share Posted April 23, 2020 why havent i seen this befooooore??? awesome tutorial, i love this format, quick and simple Link to comment Share on other sites More sharing options...
una_maquina 35 Share Posted December 18, 2020 Thanks for the "always check for null" tidbit, I haven't been doing that consistently and there are a few null pointers plaguing my script, I'll be more cautious now Link to comment Share on other sites More sharing options...
una_maquina 35 Share Posted December 18, 2020 On 9/12/2019 at 6:32 PM, DaffyDubz said: Very helpful tut, thank you. I have a question regarding abstract vs task. In task, is there no need to loop through each node in the onloop? Or just declaring then in start is enough? Im on mobile so I apologize if I missed it but your task code didn't appear to overwrite onloop. Also, currently in my first script, I'm using abstract but also nodes and running for each node in my onloop (checking the state of the script I've defined), is this ok? And is there a better way to pass my main class to the nodes than passing the whole class each time? Im using both public and private variables (private all have get set obviously) but just curious if there's a better practice than what I've currently done. It feels very sloppy to me lol but it's also pretty half-assed (some of my classes are very messy) and it's just a rs script so I'm not too worried because it works, but my OCD is killing me lol. Thanks again! You're looping in the main class already, that's where you need to go through your nodes, or tasks, and activate them (that's why you have the accept method there, it activates the node if the condition is true) . So there's no need for onloops on the node classes if that makes any sense at all. I can't really help you with the second question because I haven't seen your code; but what I found out is that you just gotta practice coding and you get better at it, and figure stuff out, the more you do it. Link to comment Share on other sites More sharing options...
donvlee97 10 Share Posted April 21, 2022 This guide is very helpful! You helped me alot with the basics of the GUI's. Now I can extend it to my likings! Thanks! Dani Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now