Vurqol Posted September 22, 2018 Share Posted September 22, 2018 (edited) I hadn't seen this anywhere in snippets over a quick glimpse. Could be used to avoid a setting in a GUI, or shortening some code, making something look neater, all comes down to preference. if (Banks.FALADOR_EAST.contains(myPlayer()) && getInventory().contains("Rune essence") || getInventory().contains("Pure essence")); walking.webWalk(ENTRANCE); Edited September 22, 2018 by Vurqol 1 Link to comment Share on other sites More sharing options...
Explv Posted September 22, 2018 Share Posted September 22, 2018 (edited) I mean, there aren't snippets of this for the same reason there aren't snippets of how to use a for loop, or what an int is. It's covered in basic Java tutorials, and doesn't need to be repeated here. Edited September 22, 2018 by Explv 4 Link to comment Share on other sites More sharing options...
FrostBug Posted September 22, 2018 Share Posted September 22, 2018 (edited) 2 hours ago, Vurqol said: I hadn't seen this anywhere in snippets over a quick glimpse. Could be used to avoid a setting in a GUI, or shortening some code, making something look neater, all comes down to preference. if (Banks.FALADOR_EAST.contains(myPlayer()) && getInventory().contains("Rune essence") || getInventory().contains("Pure essence")); walking.webWalk(ENTRANCE); An if-statement terminated by ';' has no effect other than evaluating the expression. The webwalk will be executed regardless of your inventory content or location. Additionally you should use parantheses to clarify your logic groupings; otherwise you'll quickly end up with results that weren't what you expected. To clarify on the precedence a bit: I assume by your example, you want to webwalk if you are in the bank and have either essence type. Like so: inBank && (hasRuneEss || hasPureEss) But since && has higher precedence than ||, what's actually happening is this: (inBank && hasRuneEss) || hasPureEss Which means that is doesn't matter if you are in the bank or not, as long as you have pure essence Bit of an odd snippet still though. Edited September 22, 2018 by FrostBug 8 Link to comment Share on other sites More sharing options...
HeyImJamie Posted September 22, 2018 Share Posted September 22, 2018 (edited) 1 hour ago, Vurqol said: While you're right there are a lot of people who like to make their own scripts, or try too. But rather lack the knowledge, and the basics to know what they're doing. So they use methods such as copy and pasting until they understand the script that they're using. A snippet is a snippet. If you don't have any need for it, then it's not useful to you. Although it may be useful to others. It'd be slightly useful if any part of it was correct. As mentioned above, your walking call will be made no matter the outcome of your if statement, and your if statement as it stands currently checks if you're in the bank and your inventory contains rune essence OR your inventory contains pure essence, with no bank check. The correct code would be: if (Banks.FALADOR_EAST.contains(myPlayer()) && (getInventory().contains("Rune essence") || getInventory().contains("Pure essence"))) { // walk } although, you could just simplify it to: if (Banks.FALADOR_EAST.contains(myPlayer()) && getInventory().contains("Rune essence", "Pure essence")) { // walk } Edited September 22, 2018 by HeyImJamie Link to comment Share on other sites More sharing options...
Juggles Posted September 22, 2018 Share Posted September 22, 2018 Use ( for || ) also don't webwalk when in the bank. What happens if you lag outside the bank? The script will do nothing. Rather check if you're in area you want to walk to Link to comment Share on other sites More sharing options...
Alek Posted September 22, 2018 Share Posted September 22, 2018 It's always great learning new things and being able to make your application more powerful. These operators are part of the basic set of Java operators, so most people here are confused as to why you are posting it. Here is a list of all Java operators, make sure to familiarize yourself with all of them (except bitwise). Once you master everything, then try out the bitwise operators: https://www.tutorialspoint.com/java/java_basic_operators.htm 2 Link to comment Share on other sites More sharing options...