erenjwz Posted February 9, 2018 Share Posted February 9, 2018 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... Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted February 9, 2018 Share Posted February 9, 2018 You were Scripter 2 and you can't figure out how lists work? Wat. 1 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted February 9, 2018 Share Posted February 9, 2018 localwalker is now WalkingEvent or getWalking().walk(...) Uses LinkedList<Position> Quote Link to comment Share on other sites More sharing options...
erenjwz Posted February 9, 2018 Author Share Posted February 9, 2018 It's night here wanna finish this but also want to sleep, brain is half working. Can you help? Quote Link to comment Share on other sites More sharing options...
dreameo Posted February 9, 2018 Share Posted February 9, 2018 You can convert the array to a list. 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted February 9, 2018 Share Posted February 9, 2018 2 minutes ago, dreameo said: You can convert the array to a list. Quote Link to comment Share on other sites More sharing options...
dreameo Posted February 9, 2018 Share Posted February 9, 2018 https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#asList(T...) Quote Link to comment Share on other sites More sharing options...
The Hero of Time Posted February 9, 2018 Share Posted February 9, 2018 17 minutes ago, HeyImJamie said: You were Scripter 2 and you can't figure out how lists work? Wat. Quote Link to comment Share on other sites More sharing options...
Token Posted February 10, 2018 Share Posted February 10, 2018 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()); 1 Quote Link to comment Share on other sites More sharing options...