Skip to content

Flee expressions

gotmachine edited this page Sep 28, 2021 · 1 revision

Summary of the Flee expression syntax :

The expression language is a mix of elements of C# and VB.NET. The language is strongly typed and not case-sensitive :

Element Description Example
+, - Additive 100 + a
*, /, % Multiplicative 100 * 2 / (3 % 2)
^ Power 2 ^ 16
- Negation -6 + 10
+ Concatenation "abc" + "def"
<<, >> Shift 0x80 >> 2
=, <>, <, >, <=, >= Comparison 2.5 > 100
And, Or, Xor, Not Logical (1 > 10) and (true or not false)
And, Or, Xor, Not Bitwise 100 And 44 or (not 255)
If Conditional If(a > 100, "greater", "less")
Cast Cast and conversion cast(100.25, int)
[] Array index 1 + arr[i+1]
. Owner / included type member varA.varB.function("a")
String literal "string!"
Char literal 'c'
Boolean literal true AND false
Real literal Double and single 100.25 + 100.25f
Integer literal Signed/unsigned 32/64 bit 100 + 100U + 100L + 100LU
Hex literal 0xFF + 0xABCDU + 0x80L + 0xC9LU

Additionally, all expressions can call the .Net System.Math static methods. You don't need to use the Math. prefix to use them in expressions. Here is a summary of the most useful methods. Note that the available parameters / return types can vary, consult the above link for details.

Method Description
Abs(num1) Returns the absolute value of a specified number.
Acos(num1) Returns the angle whose cosine is the specified number.
Asin(num1) Returns the angle whose sine is the specified number.
Atan(num1) Returns the angle whose tangent is the specified number.
Ceiling(num1) Returns the smallest integral value greater than or equal to the specified number.
Cos(num1) Returns the cosine of the specified angle.
Exp(num1) Returns e raised to the specified power.
Floor(num1) Returns the largest integral value less than or equal to the specified number.
Log(num1) Returns the natural (base e) logarithm of a specified number.
Log(num1, num2) Returns the logarithm of a specified number num1 in the specifed base num2
Log10(num1) Returns the base 10 logarithm of a specified number.
Max(num1, num2) Returns the larger of two specified numbers.
Min(num1, num2) Returns the smaller of two numbers.
Pow(num1, num2) Returns num1 raised to the specified power num2
Round(num1) Rounds num1 to the nearest integer
Round(num1, num2) Rounds num1 to the specified number num2 of fractional digits.
Sign(num1) Returns a signed integer that indicates the sign of a number.
Sin(num1) Returns the sine of the specified angle.
Sqrt(num1) Returns the square root of a specified number.
Tan(num1) Returns the tangent of the specified angle.
Truncate(num1) Calculates the integral part of a number.

TODO : document the available properties in VesselDataBase, VesselHabitat, etc See https://ejball.com/XmlDocMarkdown/ for a way to generate a markdown documentation from the source

name description
Altitude { get; } in meters
AngularVelocity { get; } in rad/s
ConnectionInfo { get; }
CrewCapacity { get; } crew capacity of the vessel
CrewCount { get; } number of crew on the vessel
EnvGammaTransparency { get; } [environment] proportion of ionizing radiation not blocked by atmosphere
EnvHabitatRadiation { get; } [environment] radiation effective for habitats/EVAs
EnvInAtmosphere { get; } Is the vessel inside an atmosphere ?
EnvInBreathableAtmosphere { get; } Is the vessel inside a breatheable atmosphere and at acceptable pressure conditions ?
EnvInOxygenAtmosphere { get; } Is the vessel inside a breatheable atmosphere ?
EnvLanded { get; } [environment] true if on the surface of a body
EnvRadiation { get; } [environment] radiation at vessel position
EnvStaticPressure { get; } current atmospheric pressure in atm
EnvStorm { get; }
EnvStormRadiation { get; }
EnvTempDiff { get; } [environment] difference between environment temperature and survival temperature
EnvTemperature { get; } [environment] temperature ar vessel position
EnvUnderwater { get; } [environment] true if inside ocean
EnvZeroG { get; } [environment] true if in zero g
Habitat { get; } habitat info
InFullShadow { get; } True if less than 10% of the current update was spent in the direct light of the main star
InSunlight { get; } True if at least half of the current update was spent in the direct light of the main star
IrradianceAlbedo { get; } star(s) irradiance (W/m²) reflected by the nearest body (and it's parent planet if it's a moon)
IrradianceBodiesCore { get; } thermal irradiance (W/m²) from the nearest body (and it's parent planet if it's a moon), induced by the body own intrinsic sources
IrradianceBodiesEmissive { get; } thermal irradiance (W/m²) from the nearest body (and it's parent planet if it's a moon), induced by the star(s) heating effect on the body
IrradianceStarTotal { get; } direct star(s) irradiance (W/m²) from all stars at vessel position, include atmospheric absorption if inside an atmosphere
IrradianceTotal { get; } total irradiance from all sources (W/m²) at vessel position
IsEVA { get; }
Latitude { get; } in degree
Longitude { get; } in degree
MainStarSunlightFactor { get; } % of time spent in the main star direct light (for the current environment update)
ResHandler { get; }
Clone this wiki locally