The node IDs are generated by unvFindObject which doesn't run them in order. In SOTP it starts at C1 and tacks SE onto the end.
So I'm looking to sort an unvFindObject list by sysGetTopologyDistance (and work out how to use sort in general inside other code).
The furthest system from "G2" will be first on the list, followed by the second most distant, etc etc. (or the other way from SE, both should work).
I can get the topology distances and generate a list of them. But if I sort that list I lose the node IDs from unvFindObject which are needed in the mod code.
Code: Select all
(map (unvFindObject "t +unid:0xD7892102;") unvEntry (sysGetTopologyDistance (@ unvEntry 2) "G2"))
I've tried any number of ways of putting 'sort' in there, either inside the 'exp' part of map or around the whole lot but all I've managed to do is swap the order of the list from "C4" to SE to SE to "C4".
Can 'sort' be used in there somehow? Or is it a case of checking the list and extracting the highest (or lowest) topology distance, adding that to a list, removing it from the original list and running throught the reduced list again and again until all values are sorted?
I've used a hack job to get around this in the short term by stripping any SE entries and appending the remaining list back onto the SE entry but this doesn't work in VOTG or custom topologies.
TIA for any suggestions.