sysFindObject queries

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

sysFindObject queries

Post by relanat » Fri Feb 03, 2017 11:53 pm

This code lists all large, friendly, active stations and CSCs in a system and works fine.

Code: Select all

(setq stationList (sysFindObject gSource "AFT +populated;"))
(setq CSCList (sysFindObject gSource "sD:CSC"))
(setq allList (append stationList CSCList))
But I vaguely recall something about stacking criteria to select weapons but can't remember where or which function.
Is it possible to do something like this? (doesn't work)

Code: Select all

(sysFindObject gSource "s D:CSC; AFT +populated;")
And if so what is the format? 'cat' doesn't work in any of the formats I've tried.
Or can "AFTs" be filtered somehow to only include objects that show on the system map?

Trying to generate a list of all large, active, friendly stations and CSCs in a system so the player can jump to them on demand.

==============================
While we're on sysFindObject, does anyone know what the 'B' criteria in the following code does?
It doesn't appear in any of the function explanations or criteria lists I've seen. Possibly a reference to the ship name or type?

From CorporateHierarchy.xml 1.7b4, line 925 and Luminous.xml, line 232

Code: Select all

(setq gList (sysFindObject gPlayerShip "s B:auton; O:escort;"))

(setq targets (sysFindObject gSource "sEN:20; B:luminousDrone;"))
==============================
And what's the difference between using Nil and gSource or gPlayership as the source for sysFindObject? I thought it was positional, Nil being the centre of the system, but they bring up different lists.

===============================
Also this is used a couple of times in Transcendence_Source

Code: Select all

(sysFindObject theSource (cat "NG:" gateID)
as well as this once

Code: Select all

(sysFindObject markerObj (cat "tN:" radius "; +asteroid;"))
Included here so people are aware that the 'cat' format will work.

User avatar
Xephyr
Militia Captain
Militia Captain
Posts: 792
Joined: Fri Dec 14, 2007 1:52 am
Location: Orion Arm, Milky Way

Re: sysFindObject queries

Post by Xephyr » Sat Feb 04, 2017 12:08 am

The "B" criteria for space objects is used to filter by attribute. Refer to the spaceObject criteria legend on the wiki. Presumably this is used when you're searching only by attribute, because the string can accept attributes as "+attribute;" when other criteria are present.
Project Renegade (Beta) : "The Poor Man's Corporate Command!"
"Cowards die many times before their deaths; The valiant never taste of death but once. " -Julius Caesar as written by William Shakespeare, a notorious permadeath player.

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

Re: sysFindObject queries

Post by NMS » Sat Feb 04, 2017 5:42 am

But I vaguely recall something about stacking criteria to select weapons but can't remember where or which function.
You may be thinking of "^", which can be used to force the result to match multiple criteria (AND) when it would otherwise only need to match one (OR). This definitely works in item criteria, but I'm not sure about space object criteria. Most of them act like ANDs anyway, or are mutually exclusive. There's probably no way to combine the criteria strings for multiple categories of objects with different requirements. Criteria strings just aren't as flexible as code.


Or can "AFTs" be filtered somehow to only include objects that show on the system map?
Although there's a function to set whether an object's map label is shown, there doesn't seem to be a function or property to check. I'll ticket that. With XML functions, you could exclude objects that have no map label by default, but this wouldn't apply to objects whose map label is hidden by the system definition, like the stations around Starton Eridani. You can check for this with:

Code: Select all

(xmlGetAttrib (typGetXML (objGetType theObject)) 'noMapLabel)
Your mod would need to have usesXML="true".


And what's the difference between using Nil and gSource or gPlayership as the source for sysFindObject? I thought it was positional, Nil being the centre of the system, but they bring up different lists.
Depending on what options you choose in the criteria string, you may get only objects within a certain distance of the source or with a certain relationship to the source. If you don't use any of those options, you should get the same set of objects regardless of the source, although the order might be different depending on your sorting options.


Included here so people are aware that the 'cat' format will work.
Those examples work because (cat) combines the strings and numbers into a single valid criteria string.

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

Re: sysFindObject queries

Post by relanat » Wed Mar 01, 2017 5:37 am

Thanks, xephyr. Excellent info.

And yes, I was thinking of ^. But it won't be necessary because a combination of the check for map label function (which George has already done) and filtering XML for 'noMapLabel sounds like it will bring up exactly the list I was looking for. Many thanks for that NMS.

And, thanks, I think I've worked the 'source' difference out now. sysFindObject doesn't just search for the attribute 'friendly', it searches for objects friendly to the 'source'. That was why gPlayership brought up a shorter list than using Nil. All objects 'not friendly to the ship' were excluded. Cheers. :D

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest