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.

Tips on how to not be bad

Featured Replies

thisIsCamelCase

 

You use the above syntax to denote a field that is not final, examples:

int numOne;
Object objOne;

public protected private abstract static final synchonized

 

The above are modifiers you use before defining a field or method, examples:

public static final String NAME;
protected void method1() { }

That is the order you should be putting them in, omitting any unused modifiers. You'll probably never use transient, volatile, or native modifiers, so they won't be included in the above order.

 

 

byte short int long float double boolean char

 

The above are primitive data types that you are able to compare equality with the == operator, examples:

int numOne = 1;
int numTwo = 2;
public static void main(String[] args) {
    System.out.println(numOne == numTwo);
    //If you run the above code, it will print out as 'false'
}

ClazzName

 

The above is the correct syntax for class names; the first letter of each word should be capitalized, examples:

class TestClazz { }
class TipsOnHowToNotBeBad { }

I_AM_A_FINAL_FIELD

 

The above is the correct syntax for defining a final field, examples:

int MAX_VALUE = Integer.MAX_VALUE;
int MIN_VALUE = Integer.MIN_VALUE;

.equals(Object obj)

 

The above is a method that is inherited from the Object class. It is used to compare two objects for equality (do not use the == operator, as stated in a previous lesson above it is for primitive data types only), examples:

String cheese = "Cheese";
String cheese2 = "Cheese";
 
public static void main(String[] args) {
    System.out.println(cheese.equals(cheese2));
    //If you run the above code, it will print out as 'true'
}

public void method1() {

 

}

 

public void method2()

{

 

}

 

public void method3(){

 

}

 

The above are three different ways to format your braces in java. All 3 are correct, but you should never mix one with another. 

 

 

if (booleanValue)

    method1();

 

The above is an if statement that has the braces omitted. You should only do this if there is only one line of code that is executed inside the if statement (note that you can also do this with for and while loops).

 

 

int numOne;

String stringOne;

 

public Clazz(int numOne) {

    this(numOne, "Default);

}

 

public Clazz(int numOne, String stringOne) {

    this.numOne = numOne;

    this.stringOne = stringOne;

}

 

The above is an example of Constructor overloading. In the first constructor, you are only required to pass in an int, and the String field is automatically assigned whereas in the second constructor you are required to provide both an int and a String.

 

 

If you learned anything from this, congratulations, you're less bad than you were before.

Edited by Sigma

Anyone who has had a real programming class should know this. This is great for beginners though.

Should mention this

if (boolean == true)

And

if (boolean == false)

I've seen a lot of script writers do that lately..

Should mention this

if (boolean == true)

And

if (boolean == false)

I've seen a lot of script writers do that lately..

I remember doing this sooo long ago, I felt so stupid when I realised what I was doing wrong lmao. (Not that it's wrong)

I remember doing this sooo long ago, I felt so stupid when I realised what I was doing wrong lmao. (Not that it's wrong)

didnt you just do it yesterday? :o
  • Author

Should mention this

if (boolean == true)

And

if (boolean == false)

I've seen a lot of script writers do that lately..

That isn't wrong, it's just more code.

That isn't wrong, it's just more code.

i know but it's worth mentioning because it looks completely retarded

Mention constructors and constructor overloading. Beginners get stuck when learning object oriented programming and maybe some getter/setter methods too. Great basic tutorial which scripters SHOULD all know. ^_^

  • Author

Where you have method 1, 2, 3 don't forget to add the ()

Good catch, it was pretty late when I was writing this.

lol, are you serious.

Of course. If you want me to make a tutorial of "your level", please let me know and I'd be happy to have you learn something new.

Guest
This topic is now closed to further replies.

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.