Jump to content

Custom Script Skeleton,


Recommended Posts

Posted

Hi,

I was wondering if somebody could potentially make a script skeleton for me - so I can add to and finish? 

 

There's some tasks I'm having a hard time with and wondered if someone could help? 

 

  • Walk to nearest Bank 
  • Opens Bank
  • Check for array of items
  • Withdraws Items
  • Walk to specific area

From there I can hopefully learn the functions of the API and start building my ideas - I'd really appreciate any support.

Posted
21 minutes ago, subpars said:

Walk to nearest Bank 

Here ya go
 

Spoiler
    private Area[] banks;

    @Override
    public void onStart() {
        setBanks();
    }

    private void setBanks() {
        final List<Area> banksList = new ArrayList<>();

        for (final Field bank : Banks.class.getDeclaredFields()) {
            try {
                banksList.add((Area) bank.get(Banks.class));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }

        banks = banksList.toArray(new Area[0]);
    }

 

And can be used like this to walk to nearest bank

getWalking().webWalk(banks);
  • Sad 1
  • Heart 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...