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
  • Is it possible to cancel walk methods?


    brbxd

    Recommended Posts

    Hey guys, I'm trying to improve performance on one of my scripts. Is there a way I can can click once on the minimap, and instead of having multiple clicks (I know how sleep works too, that's different than what I'm trying to do) to where it just clicks once, and then proceeds to the next line of code? For example: Imagine I'm running to the bank, I have an area designated both in and a little bit outside of the bank, and I want my character to click on the bank while running, instead of focusing specifically on getting to the area. This may sound confusing, but I'm open to suggestions thanks!

    Also, I might as well knock this question out real quick

    sleepUntil(() -> bankArea.contains(getLocalPlayer()), 5000);

    in the first argument, what exactly is "() ->" doing? I tried leaving it without that, and I had an error. Is this some type of casting?

    Again,

    Thank you!

    Link to comment
    Share on other sites

    Okay, after some tinkering with sleepuntil() I figured out what I was looking for, second question is still up for grabs though, thanks! :)

    Link to comment
    Share on other sites

    It's a lambda function. It's basically another way of writing a function, it's easier.

    Inside "()" are placed arguments, in your case there are no arguments that's why it's empty. After -> you can write a method or some true/false statement, as far as I remember. In your case it's just a true/false statement.

    This is how your method would look without lambda function

    	    sleepUntil(new Condition() {
                @Override
                public boolean verify() {
                    return bankArea.contains(getLocalPlayer());
                }
            }, 5000);

    Read here and check the examples for more accurate information

    https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/Lambda-QuickStart/index.html

    Link to comment
    Share on other sites

    2 hours ago, ozeki6 said:

    It's a lambda function. It's basically another way of writing a function, it's easier.

    Inside "()" are placed arguments, in your case there are no arguments that's why it's empty. After -> you can write a method or some true/false statement, as far as I remember. In your case it's just a true/false statement.

    This is how your method would look without lambda function

    
    	    sleepUntil(new Condition() {
                @Override
                public boolean verify() {
                    return bankArea.contains(getLocalPlayer());
                }
            }, 5000);

    Read here and check the examples for more accurate information

    https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/Lambda-QuickStart/index.html

    This helps a lot, thank you.

    2 hours ago, offerupuser10 said:

    1. Something like.

    
    	boolean walkFlag;
    	public void walking(Tile t) {
    		if (!walkFlag) {
    			break;
    		}
    		getWalking().walkExact(t);
    	}

    2. I assume its a condition,. E.g: SleepUntil Condition = true/false.

    This also helps, thank you too.

    Link to comment
    Share on other sites

    -> implies you are using a Lambda, which is essentially a faster way to write for a new function.

     

    For example:

    myMethod(new Condition() {

         return !myPlayer.isWalking();

    }

     

    Can be written easily this way:

    myMethod(() -> !myPlayer.isWalking());

    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.