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.

How can I store multiple areas in one array?

Featured Replies

Well i don't see the point in coding more than you have to... :/

 

Sure this:

public enum Location {
//your pre-definding the value of whatever you need.
    AREA_ONE(new Area(3092, 3246, 3095, 3240)),
    AREA_TWO (new Area(3215, 9623, 3219, 9620)),
    AREA_WHATEVER_YOU WANT (new Area(3207, 3220, 3210, 3216)),
    ;

    //these are the private fields you pre-definded
    private Area area;

    //constructor add what values you need to pre-define
    private Location(Area area){
        this.area = area;
    }

    //these are simple getter methods.
    //setter method arent allowed because the values are pre-fined so they are basically static.
    public Area getArea(){
        return this.area;
    }
}

Looks great and all but why when

Area AREA_ONE = new Area(3092, 3246, 3095, 3240);
Area AREA_TWO = new Area(3215, 9623, 3219, 9620);
Area AREA_WHATEVER_YOU_WANT = new Area(3207, 3220, 3210, 3216);

Would do the same thing :/

or even storing it it a lil nooby class like

public class Areas {
    static Area AREA_ONE = new Area(3092, 3246, 3095, 3240);
    static Area AREA_TWO = new Area(3215, 9623, 3219, 9620);
    static Area AREA_WHATEVER_YOU_WANT = new Area(3207, 3220, 3210, 3216);
}

would do the same thing :/ It might just be me being super lazy but i see no point in over complicating the situation sad.png

Someone plz enlighten me.

 

 

I think you have a misunderstanding of the concept of reuse. Enums are made exactly for things such as this.

I think you have a misunderstanding of the concept of reuse. Enums are made exactly for things such as this.

Reuse in which way, more than one time in the same script or across multiple?

Reuse in which way, more than one time in the same script or across multiple?

 

 

Either way. If you make that enum one time, you can just call it from the enum each time you need that area. I keep all of my scripts in the same project, that way I can reuse every bit of my custom API code, web walker, etc. and I never have to rewrite code for any script twice if I have already written it. Then when I compile, I just compile the one script class that I want to submit. ^_^

Either way. If you make that enum one time, you can just call it from the enum each time you need that area. I keep all of my scripts in the same project, that way I can reuse every bit of my custom API code, web walker, etc. and I never have to rewrite code for any script twice if I have already written it. Then when I compile, I just compile the one script class that I want to submit. happy.png

Gave me a fun idea.

 

Whats better about an enum compared to having a list of areas in a separate class?

Edited by Isolate

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.