Skip to content

Custom Criteria

Xjph edited this page Jan 14, 2021 · 5 revisions
Element: ObservatoryCriteria
	All criteria are contained withing a single root ObservatoryCriteria element,
	this is required and there must be only one. 

Element: Criteria
	Inside the ObservatoryCriteria can be any number of Criteria elements,
	each of which must have a Comparator attribute and depending on the 
	comparator used, up to two value attributes.
	Value Comparators are "Greater", "Less", "Equal", and "Between".
	"Between" comparisons require LowerValue and UpperValue attributes, 
	while all others use only a single Value.
	Logical Comparators without values are "And", "Or", and "Not".
	
	Each Criteria element must contain one Operation and one Description,
	and optionally one Detail element.
	For value comparison criteria the result of the Operation element is
	tested against the criteria's comparator and value and is added to
	Observatory's list of interesting bodies if the criteria is met.
	For logical criteria the operator specified is applied to additional
	Criteria elements nested within before any of them are added to the list.
	
	Description and Detail are ignored inside nested criteria for logical
	operations. Only the top level description and detail are used.

Element: Operation
	Operation elements describe mathematical to perform	on event values,
	static numbers, or the results of other operations.
	Each Operation must have a Operator attribute, being one of "Multiply",
	"Divide", "Add", "Subtract", or "None".
	
	The Operation element must contain up to two elements, FirstValue and
	SecondValue. The "None" operation uses only FirstValue, passing it's
	value unchanged, while all others require both. FirstValue and SecondValue
	are explictly ordered in this fashion to preserve the order of operands
	for subtraction and division.

Element: FirstValue and SecondValue
	All value elements must have a Type attribute, which can be "Number",
	"EventData", or "Operation".
	
	Number values contain a simple numeric value to be used by the operation.
	
	EventData values are used to get data from the scan event being processed.
	The details are found below.
		
	Operation values contain a single Operation element, the result of which
	is used as a value in the containing operation. Operations can be nested in
	this manner without limit, to create mathematical formulae of arbitrary
	complexity.

Value Type: EventData
	Indicates the scan event data you want to use for a FirstValue or SecondValue
	element. All quantities are in the original units used by the journal file.
	
	Valid values are:
	
		DistanceFromArrivalLS
		TidalLock
		TerraformState
		Atmosphere
		Volcanism
		MassEM
		Radius
		SurfaceGravity
		SurfaceTemperature
		SurfacePressure
		Landable
		SemiMajorAxis
		Eccentricity
		OrbitalInclination
		Periapsis
		OrbitalPeriod
		RotationPeriod
		AxialTilt
		StellarMass
		AbsoluteMagnitude
		Age_MY
		WasDiscovered
		WasMapped
		ReserveLevel
		Rings
		Ring:Count
		Ring:{n}:{Property}
		PlanetClass:{Class Name}
		Parent:{Parent Body Event Data}
		AtmosphereType:{Type}
		AtmosphereComposition:{Element}
		ParentType:{n}:{Type}
		StarType:{Type}
		
	TerraformState, Atmosphere, and Volcanism return a simple 1 or 0 if they
	are populated, there is not currently a means to check for specific atmosphere
	or volcanism types. This may change in a later version.
	
	PlanetClass checks for a specific body type, as provided after the ":". The
	class must be an exact case-insensitive match for the class text found in the
	journal file. For example "PlanetClass:Sudarsky class V gas giant".
	
	ReserveLevel returns a number from 1 (depleted) to 5 (pristine).

	Ring can be used to get a simple count of the rings with the "Count" property,
	or specific information about rings by specifying a ring number followed by one
	of "InnerRad", "OuterRad", "Mass", or "Class".
	"Class" must be followed by a specific class to check for when used as a value,
	e.g. "Ring:2:Class:Metallic". A specific class is not necessary when used as a 
	detail item.

	Rings returns a simple count of the number of rings a body has. Details of those
	rings are not yet available. This may change in a later version.
	
	Parent looks for the parent body's scan event and if found will check for the
	corresponding value, e.g., "Parent:MassEM". Parent data can be extended
	indefinitely if you need data for the parent's parent, or deeper if desired,
	e.g., "Parent:Parent:Parent:PlanetClass:Earthlike Body".
	NOTE: Parent data is only available if the parent is scanned before the child
	body. Checks that rely on parent data will fail to trigger if child bodies
	are scanned first.

	AtmosphereType returns 1 if the type scanned matches the type provided, otherwise
	returns 0, e.g., "AtmosphereType:CarbonDioxide".

	AtmosphereComposition gets the percentage amount of the specified element, e.g.,
	"AtmosphereCompsotion:Argon".

	ParentType checks the nth parent body type against the type specificed (options
	"Planet", "Star", and "Null") and returns 1 for a match, or 0 otherwise, e.g.,
	"ParentType:1:Planet".

	StarType works much like PlanetClass and checks for a specific star type, as
	provided after the ":". Provided type to check for must match the types used
	in the journal file, e.g., "StarType:H" for black holes.
	
Element: Description
	Contains simple text which is displayed in Observatory's description column.
	
Element: Detail
	Contains any number of Item elements to display the values of in Observatory's
	detail column, so that the numbers behind the criteria checks can be seen by
	the user, if desired.
	This element is optional.
	
Element: Item
	Contains the scan event item you want to display the details of. Used in the
	same manner as the EventData value type, with the same valid values, with the
	exception of PlanetClass, which does not require a specific class to be
	specified.

Samples:

<!-- Example check for greater than 1 earth-mass and tidally locked -->
<!-- Demonstrates simple arithmetic on event values and use of detail items -->
<Criteria Comparator="Greater" Value="0">
	<Operation Operator="Multiply">
		<FirstValue Type="Operation">
			<Operation Operator="Subtract">
				<FirstValue Type="EventData">MassEM</FirstValue>
				<SecondValue Type="Number">1</SecondValue>
			</Operation>
		</FirstValue>
		<SecondValue Type="EventData">TidalLock</SecondValue>
	</Operation>
	<Description>>1EM and Tidal Lock</Description>
	<Detail>
		<Item>MassEM</Item>
		<Item>OrbitalPeriod</Item>
	</Detail>
</Criteria>

<!-- Example check for a body larger than half the size of its parent -->
<!-- Demonstrates use of parent event data -->
<Criteria Comparator="Greater" Value="0.5">
	<Operation Operator="Divide">
		<FirstValue Type="EventData">Radius</FirstValue>
		<SecondValue Type="EventData">Parent:Radius</SecondValue>
	</Operation>
	<Description>>50% size of parent</Description>
	<Detail>
		<Item>Radius</Item>
		<Item>Parent:Radius</Item>
	</Detail>
</Criteria>

<!-- Example check for landable moon of an icy body with rings-->
<!-- Demonstrates logical criteria and "none" operation -->
<Criteria Comparator="And">
	<Criteria Comparator="Greater" Value="0">
		<Operation Operator="Multiply">
			<FirstValue Type="EventData">Parent:PlanetClass:Icy Body</FirstValue>
			<SecondValue Type="EventData">Parent:Rings</SecondValue>
		</Operation>
	</Criteria>
	<Criteria Comparator="Equal" Value="1">
		<Operation Operator="None">
			<FirstValue Type="EventData">Landable</FirstValue>
		</Operation>
	</Criteria>
	<Description>Ringed Icy Body w/ Landable Moon</Description>
	<Detail>
		<Item>Parent:Rings</Item>
	</Detail>
</Criteria>
Clone this wiki locally