February 9, 20187 yr 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...
February 9, 20187 yr localwalker is now WalkingEvent or getWalking().walk(...) Uses LinkedList<Position>
February 9, 20187 yr Author It's night here wanna finish this but also want to sleep, brain is half working. Can you help?
February 9, 20187 yr 17 minutes ago, HeyImJamie said: You were Scripter 2 and you can't figure out how lists work? Wat.
February 10, 20187 yr 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());
Create an account or sign in to comment