sysFindObject queries

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

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.
Stupid code. Do what I want, not what I typed in!
User avatar
Xephyr
Militia Captain
Militia Captain
Posts: 857
Joined: Fri Dec 14, 2007 1:52 am
Location: Orion Arm, Milky Way
Contact:

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!"
Real programmers count from 0. And sometimes I do, too.
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8:26 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 Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 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
Stupid code. Do what I want, not what I typed in!
Post Reply