With the addition of the 'P' criteria to 'unvFindObject' from 1.9a1 I was looking to automate the creation of Commander's Log entries at game start. This would create the data needed to show entries for the stations that are already known at game start, eg, Point Juno, Cathedral of Domina, etc, as show in the galactic map. Previously each station had their data entered manually in a separate helper function. Using code will handle any future (friendly) stations that are set known at game start.
The desired output is as shown in the attached composite image
The screen shows each system with station type names and a count of stations with that type name (even if they are different types). Split into ten different categories.
What is needed is to get this struct output:
Code: Select all
{
"A7":("" "" "Commonwealth settlement: 2" Nil Nil Nil "" "" Nil Nil)
BA:("" "" "Battle Arena Maximus: 1" Nil Nil Nil "" "" Nil Nil)
CD:("" "" "Cathedral of Domina: 1" Nil Nil Nil "" "" Nil Nil)
PJ:("" "" "Point Juno: 1" Nil Nil Nil "" "" Nil Nil)
SK:("" "" "Arcology of New Victoria: 1" Nil Nil Nil "" "" Nil Nil)
TauCeti:("" "" "corporate metropolis: 1" Nil Nil Nil "" "" Nil Nil)
}
Code: Select all
(unvFindObject 'TVAP-arcology)
->
((1921 1318913 BA "Battle Arena Maximus" 0)
(3584 1056799 SK "Arcology of New Victoria" 1)
(6604 1048628 CD "Cathedral of Domina" 1)
(11450 1712136 PJ ": Point Juno" 0)
(12279 1056770 "A7" "Commonwealth Settlement 5238" 64)
(12320 1056770 "A7" "Commonwealth Settlement 7440" 64)
(16783 8454225 TauCeti "Icarus Station" 64))
Each nodeID key has a list of 10 entries. These correspond to various objects like stargates, CSCs, friendly stations, etc as per the headings in the image. If no objects of that sort are known in the system the value is Nil or "" and the screen shows nothing. The third value in the list is for stations friendly to the player. The text inside the value is displayed using 'scrSetDisplayText'. Fortunately all the stations are friendly so all will be listed in the third value of the list. The other 9 entries will always be Nil or "" at game start.
I could probably work out how to do this if there was only ever one of any station. But I think the multiple Comm settlements require another cycle of code and I don't know how to do this.
The type and the nodeID are the two important values. The type name is used, not the object name, so the object name and flags aren't needed, neither is the ID. An additional complication is the use of the same type name by different types. So checking against the type name is required, not against the type. The code will run in <OnGlobalUniverseCreated>.
Possibly using a list of the nodeIDs and checking every entry by that will work? Save the type name and set the count at 1. Then checking the type name of the next entry of the same nodeID and if that type name already exists add 1 to the count value. Then check the next nodeID.
Or creating a new struct from these entries with only the nodeID and type saved. Then use that to check against.
Any help will be greatly appreciated. I have been battling against this for a while now with very limited success. TIA.