brbxd 2 Share Posted September 12, 2018 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 More sharing options...
brbxd 2 Author Share Posted September 13, 2018 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 More sharing options...
ozeki6 32 Share Posted September 13, 2018 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 More sharing options...
brbxd 2 Author Share Posted September 13, 2018 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 More sharing options...
ArmyofDragons 28 Share Posted September 14, 2018 -> 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.