Skip 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.

Private final

Featured Replies

Hello people of OSBot,

I have a short question, if I set a variable in the private final part of the script like this:

    private final
    Position sellPoint = new Position (3209, 3216, 2);

And later change this, in this case, change it to position (2222, 2222, 2) for example, in a private boolean statement or private void.

1. Will this be possible because of the private part?

2. Will it be changed back to the original (3209, 3216, 2) at any point?

Hope to hear from you, and if you feel like it please leave a explanation so I can learn more from it.

 

 

Ok, I suggest you learn some basic java before you start scripting, shouldn't take you long and it will save you a lot of time.
 

As for your question:

 

private means that specific var or func is only accessible from the class where you declared it.

For example:

If you use:

private int year = 2017;

in your main class, you will NOT be able to access the var year from an other class.

 

As for the final keyword

Final is a keyword that is used to declare a var as a final var, which means you can't change it. (It is constant)

In order to change the sellPoint you will need to not declare it as a final.

For example:

this is OK

 private Position sellPoint = new Position (3209, 3216, 2);

sellPoint = new Position (0, 0, 0);

But this is NOT

 private final Position sellPoint = new Position (3209, 3216, 2);

sellPoint = new Position (0, 0, 0);

 

27 minutes ago, evert123 said:

Hello people of OSBot,

I have a short question, if I set a variable in the private final part of the script like this:

    private final
    Position sellPoint = new Position (3209, 3216, 2);

And later change this, in this case, change it to position (2222, 2222, 2) for example, in a private boolean statement or private void.

1. Will this be possible because of the private part?

2. Will it be changed back to the original (3209, 3216, 2) at any point?

Hope to hear from you, and if you feel like it please leave a explanation so I can learn more from it.

 

 

 

 

EDIT: A good place to start learning Java if you need: (not sure if i can post links, google "The new boston java")

Edited by HunterRS

the keyword final means exactly what it sounds like, whatever value you declare that variable to is FINAL, it can not be changed later on in your code. Most IDEs give an error when you try to redefine a final variable anyway.

  • Author
11 hours ago, HunterRS said:

Ok, I suggest you learn some basic java before you start scripting, shouldn't take you long and it will save you a lot of time.
 

As for your question:

 

private means that specific var or func is only accessible from the class where you declared it.

For example:

If you use:

private int year = 2017;

in your main class, you will NOT be able to access the var year from an other class.

 

As for the final keyword

Final is a keyword that is used to declare a var as a final var, which means you can't change it. (It is constant)

In order to change the sellPoint you will need to not declare it as a final.

For example:

this is OK


 private Position sellPoint = new Position (3209, 3216, 2);

sellPoint = new Position (0, 0, 0);

But this is NOT


 private final Position sellPoint = new Position (3209, 3216, 2);

sellPoint = new Position (0, 0, 0);

 

 

 

EDIT: A good place to start learning Java if you need: (not sure if i can post links, google "The new boston java")

Thank you very much for the detailed explanation.
I will definitely start learning more about the basics of Java, but for now I don't have much time and I use this script as a puzzle that I'm aloud to play with whenever I made some real progress with my thesis.

I know this is not really efficient on my side and even less efficient on the communities side, but ill try to make up for it in the future.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.