Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

"Or" ||

Featured Replies

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 by Vurqol

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 by Explv

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 by FrostBug

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. :boge:

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 by HeyImJamie

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 

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

 

 

  • Alek locked this topic
Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.