list splitting ship finding query

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Commander
Militia Commander
Posts: 459
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
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1421
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
AssumedPseudonym
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.
Image

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!)

NMS
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)))
			)
		1
	)
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.

relanat
Militia Commander
Militia Commander
Posts: 459
Joined: Tue Nov 05, 2013 9:56 am

Fri Feb 23, 2018 12:36 am

Thanks. All very good points that I hadn't considered.
Having a friendly and enemy alphabetical list looks the way to go, split to A-M, N-Z if too long (I hadn't even thought of that...d'oh; plus I just checked that 'sort' handles alphabetical sorting, something I didn't realise before, I thought it was numerical).

The 'find' ability is just a copy of the 'create' ability ATM. Creating needs a sovereign so the create screens sort by sovereign/disposition and I'm not sure how to handle creating the non-defaultSov ships. That's another topic somewhen!
For 'find' I just cut and pasted the 'create' code and stuck unvFindObject in there as a short term solution.
AssumedPseudonym wrote:I suppose part of the question here is, are you looking for specific ships or just ship types?
I hadn't really worked that out yet. A bit of both I think. I need to play about a bit more and see which ships will realistically need to be found and cover them. ATM the named wingman/character ships (although you will mostly know where these are) and CSCs are at the top of the list, followed by the other ship types sorted by name and then sovereign. So as an example; Centurion - Comonwealth Fleet,, Centurion - Corporate (this is Rama, so bad example!), etc.
Adding "(sovGetName (typGetProperty type 'defaultSovereign))" to NMS's code has quite a few come up as Nil for the sovereign name and drops the list back to 168 types (5 missing) for some reason. Anything with the attribute battleArena could be deleted. They won't exist anyway. And so on.

All part of the fun. Thank you all for this.

Post Reply