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

    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

    • 6 months later...

    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

    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

    • 11 months later...
    • 2 months later...

    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

    • 7 months later...
    • 4 months later...
    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

    • 1 year later...

    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.