list forming query

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

Wed Apr 13, 2016 5:25 am

I'm working on a mod which, among other things, produces a data rom with a list of all systems which have Korolov stations in them.

I can do this by using

(unvFindObj "t +korolovShipping;")

which will give me a list of sets of 5 entries (call it korolovNodeList for example)

({objID} {type} {nodeID} {objName} {objNameFlags})

I think using (@ korolovNodeList 2) will select the nodeID but I can't work out how to use enum and list and lnkAppend with it to turn it into a list of system names for display in the data ROM.

Usually I find examples in the mods or code and study them but unvFindObj isn't that common and similar examples I've found are too complex for me to decipher. And the xelerus function explanations aren't very good for these functions.

Has anyone got the time to do a post to explain what the code is and what its doing? Or point me to some code that does this (simple stuff, please) so I can work it out?
I wouldn't mind actual code here for once, but any help is greatly appreciated. This has been holding me up for months.

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

Wed Apr 13, 2016 6:10 am

Just call sysGetName on the node ID - that method will return the system name. I think that's the only part that you're missing.

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

Thu Apr 14, 2016 5:15 am

I haven't tested it, but try something like this:

Code: Select all

(enum (unvFindObj "t +korolovShipping;") theEntry
     (setq listOfSystems (append listOfSystems (sysGetName (@ theEntry 2))))
)
Edit: or

Code: Select all

(map (unvFindObj "t +korolovShipping;") theEntry
     (sysGetName (@ theEntry 2))
)

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

Tue Apr 19, 2016 3:56 am

Success! :D

Many thanks. The 'map' example worked perfectly. And is very easy to understand.
All I had to do then was spend hours working out that 'cat' doesn't like lists. :lol:

Thanks again. This was also exactly what I needed for the other mod.

Post Reply