list splitting ship finding query

Freeform discussion about anything related to modding Transcendence.
Post Reply
Militia Commander
Militia Commander
Posts: 454
Joined: Tue Nov 05, 2013 9:56 am

Tue Jan 16, 2018 11:57 pm

The GodPlayerships can find ships anywhere in the galaxy by using unvFindObject. But there are 173 ship types in SOTP. That's a bit long for a list.
So currently two options are offered. Ships with a disposition of "enemy" towards the playership (68 types) and ships with a disposition of neq "enemy" (so either friendly or neutral) (47) called "Friendly". Filtering for this requires the ship type to have a defined 'defaultSovereign'.

That leaves the 58 types that don't have a default sovereign which ATM can't be found. Adding these as a third option, "Other Ships", would be ideal but I don't know how to do it.

A couple of options I can see are:

1. Convert the type to an object and use (objGetProperty theObj 'sovereign). I think this would allow all ships to be split into neq enemy and enemy and so cover all 173 types.

2. Somehow filtering the list of 173 types to remove the 115 available types and having the remaining 58 as a separate list, "Other Ships".

I'm thinking the second option would be best as it would split the ships into 3 groups, friendly, enemy and other, and so have three lists of 68, 47 and 58 ships. But I have a hunch the 'Other' ships would be a strange and fairly unintuitive mix.
The first option would divide the list into two. So possibly about 85 each. Still a bit long IMO. Although they could be further split by ship mass; capital, medium and gunship. Not sure which would be best.

Anyone got any other ideas?

I don't know how to remove the 115 available types but think it would be some sort of arrangement of filter, lnkRemove, find or some combination like that. Anyone done something like that or can point me at an existing code example? TIA

User avatar
Fleet Officer
Fleet Officer
Posts: 1417
Joined: Tue Aug 19, 2014 10:17 pm

Wed Jan 17, 2018 1:02 am

I agree that sorting by sovereign would be unintuitive, especially for ships that appear as both friendlies and enemies. Setting up a standard alphabetically sorted list on ships' display names seems like the best way to handle this. If you want to reduce list size, splitting it into A-M and N-Z would accomplish this. It'd also be quite a bit easier to code than sorting on more ambiguous criteria.

User avatar
Militia Captain
Militia Captain
Posts: 973
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

Wed Jan 17, 2018 2:43 am

 I suppose part of the question here is, are you looking for specific ships or just ship types? It’s worth noting that there are mods which can override a shiptype’s default sovereign, and even vanilla Transcendence itself does so with the assorted Ronin variants and with Centurions — &svCommonwealthFleet; by default, but also &svCommonwealth; for Commonwealth traffic or guards, &svCorporate; for Corporate guards, and, of course, &svRogueFleet; — which could further muddle things on top of the possibility of there just not being a default sovereign at all. If you want specific ships, you’d be better off using objGetSovereign to sort things out.

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)

Militia Commander
Militia Commander
Posts: 413
Joined: Tue Mar 05, 2013 8:26 am

Wed Jan 17, 2018 11:45 pm

I agree, an alphabetical list is probably more useful. This code gives a list of entries where each entry is a list consisting of a UNID and ship class name, sorted by name:

Code: Select all

(sort (map (typFind 's) 'excludeNil type
			(if (typGetProperty type 'name) (list type (typGetProperty type 'name)))
Then you can use (loop) or (for) to split into multiple smaller lists, (map) to convert back to a list of just UNIDs, or convert to a list of structs you can give to a customPicker DockScreen, etc.

Post Reply