Jump to content

The LocalWalker changed


erenjwz

Recommended Posts

Hi,

Had been gone for 2 yearsl lost my Scripter 2 status :( /  :p
I'm still rusty.

But okay so one of my script doesnt work anymore since the localwalker has changed I tried:
    private Position[] path1 = { new Position(random(3274, 3278), random(3176, 3178), 0 ) };
    to
    private List path1 = (random(3274, 3278), random(3176, 3178), 0 );

But i don't get how Lists, I think I'm doing something wrong, can somebody push me in the right directions.

 

Much Thanks...

Link to comment
Share on other sites

1 hour ago, erenjwz said:

Hi,

Had been gone for 2 yearsl lost my Scripter 2 status :( /  :p
I'm still rusty.

But okay so one of my script doesnt work anymore since the localwalker has changed I tried:
    private Position[] path1 = { new Position(random(3274, 3278), random(3176, 3178), 0 ) };
    to
    private List path1 = (random(3274, 3278), random(3176, 3178), 0 );

But i don't get how Lists, I think I'm doing something wrong, can somebody push me in the right directions.

 

Much Thanks...

Well that's just a problem of using data structures in java, I don't think this is scripting related at all

https://www.tutorialspoint.com/java/java_data_structures.htm

Check out a few tutorials on java arrays, collections, (and streams for java 8/9) etc

https://www.tutorialspoint.com/java/java_arrays.htm

https://www.tutorialspoint.com/java/java_collections.htm

https://www.tutorialspoint.com/java8/java8_streams.htm

        // walk to some position, make sure the bot can reach that position
        // (loaded into the current region, no obstacles between
        // the bot and the destination, also check the Z coordinate because 
        // it used to not be taken into account and probably remained like this
        // for backwards compatibility)
        Position destination = new Position(someX, someY, someZ);
        if (myPosition().getZ() == destination.getZ() && getMap().canReach(destination)) {
            log(String.format("walking to %s: %b", destination, getWalking().walk(destination)));
        } else {
            // doge
        }

        // or if you want to walk a certain path, for cases where the end position may be too
        // far away to be loaded into the current region but you (assume) can 
        // reach it by advancing into the path
        Position[] path = {destination1, destination2, destination3, destination4};
        log(String.format("walking path %s: %b", Arrays.toString(path), getWalking().walkPath(Stream.of(path)
                .collect(Collectors.toList()))));

        // or just look up the LocalPathFinder in the API docs for lower level 
        // access to local region path finding 
        LocalPathFinder lpf = new LocalPathFinder(getBot());

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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