Andrew decided to call the new inputs system I cooked up "funky trees". Somehow escapes me why, but I'll roll with it. Here I'll describe what you can do in the land of funk.
Essentially what this means is that you can enter any mathematical expression (following this syntax) into an input field and it will be evaluated every frame. You can pull in data from a variety of sources, and process these how you like.
Inputs
What you can now do is use the normal input axes:
Pitch
Roll
Yaw
Throttle
Brake
Trim
VTOL
LandingGear
FireGuns
FireWeapons
LaunchCountermeasures
Activate1
Activate2
Activate3
Activate4
Activate5
Activate6
Activate7
Activate8
Flight data
In addition to this you can access some information from the aircraft:
Altitude
- Aircraft's altitude in metresAltitudeAgl
- Aircraft's altitude above ground level in metresGS
- The speed relative to the ground (m/s)IAS
- The speed relative to the air, adjusted for the desnity of the air (m/s)TAS
- The speed relative to the air (m/s)Fuel
- The amount of fuel remaining as a proportion of capacity (0 to 1)AngleOfAttack
- The angle of attack (angle airflow vertically meets the boresight) in degreesAngleOfSlip
- The horizontal equivalent of angle of attack (degrees)PitchAngle
- The pitch of the aircraft (degrees)RollAngle
- The roll of the aircraft (degrees)Heading
- The heading of the aircraft (degrees)Time
- The time since the level loaded (seconds)GForce
- The acceleration and gravitational "force" acting on the cockpit in G. I know it's not a force. Shut up.VerticalG
- The signed vertical component of the "G Force".SelectedWeaponName
- The name of the selected weaponLatitude
- The North/South position of the craft (metres)Longitude
- The East/West position of the craft (metres)PitchRate
- The pitch angular velocity in degrees/secondYawRate
- The yaw angular velocity in degrees/secondRollRate
- The roll angular velocity in degrees/second (these 3 inputs are better than usingrate(PitchAngle)
etc, because they account for wrapping around the angle, as well as being in local space:rate(Heading)
is different toYawRate
)TargetSelected
-true
if a target is selected, elsefalse
.TargetHeading
- the heading to the selected target in degrees.TargetElevation
- the vertical angle to the selected target in degrees.TargetDistance
- the distance to the selected target in metres.
Constants
Values that are always the same:
pi
the mathematical constant pi (half a tau, if you will).e
the mathematical constant e.true
a true boolean valuefalse
a false boolean value
Operators
These are useful for... maths or something.
- Mathematical:
- +, - addition and subtraction (- can be used as a unary operator, for instance
-Pitch
- *, / multiplication and division
- +, - addition and subtraction (- can be used as a unary operator, for instance
- Comparison:
- <, > less than, greater than
- <=, >= less than or equal to, greater than or equal to
- ==, != equal to, not equal to
- Boolean:
- &, AND
- |, OR
- !, NOT (this is a unary operator)
- Ternary operator:
condition ? value_if_true : value_if_false
- this chooses between two values based on the condition.
Functions
Finally, there's some helpful functions to do maths for you!
abs(x)
- The absolute (positive) value of x.ammo(name)
- The amount of ammo of the weapon withname
. Remember to put the name in " quotes.ceil(x)
- x rounded up to an integer.clamp(x, min, max)
- x clamped between min and max.clamp01(x)
- Equivalent to clamp(x, 0, 1).deltaangle(a, b)
- The shortest angle delta between angles a and b in degrees.exp(x)
- Returns e raised to the power of x.floor(x)
- x rounded down to an integer.inverselerp(a, b, x)
- Calculates the linear parameter t that produces the interpolant value within the range [a, b].lerp(a, b, t)
- Linearly interpolates between a and b, by a proportion of t.lerpangle(a, b, t)
- Similar to lerp, but interpolates correctly when values pass 360 degrees.lerpunclamped(a, b, t)
- Similar to lerp, but doesn't clamp the value between a and b.log(x, p)
- The logarithm of x in base p.log10(x)
- Equivalent to log(x, 10).pingpong(x, l)
- "Ping-pongs" the value x so it is never larger than l and never less than 0.max(a, b)
- The largest value between a and b.min(a, b)
- The smallest value between a and b.pow(x, p)
- x raised to the power of p.repeat(x, l)
- Loops the value x so it is never larger than l and never less than 0.round(x)
- Rounds x to the nearest integer.sign(x)
- The sign of x (1 if x positive, -1 if x negative)smoothstep(a, b, t)
- Similar to lerp, but with smoothing at the ends.sqrt(x)
- The square root of x.sin(x)
- The sine of x (degrees)cos(x)
- The cosine of x (degrees)tan(x)
- The tangent of x (degrees)asin(x)
- The arc-sine of x (degrees)acos(x)
- The arc-cosine of x (degrees)atan(x)
- The arc-tangent of x (degrees)
Memory Functions
These are functions that are special because their output not only depends on inputs but their previous state.
- sum(x)
- Returns the sum of all it's inputs over time (the integral of x)
- rate(x)
- Returns the rate of change of x relative to its value last frame (the derivative of x)
- smooth(x, t)
- When loaded, it's output is set to x
. As x
changes, the output tries to move to x
, but at a rate of no greater than t
. This is vaguely equivalent to changing the speed of a rotator.
- PID(target, current, p, i , d)
- Evaluates a PID controller with the setpoint of "target", process variable "current" and the gains p, i, and d. Equivalent to: p * (target - current) + i * sum(target - current) - d * rate(current)
With all of these at your disposal, I'm excited to see what kind of contraptions you guys come up with, and I'm also open to some suggestions as to some things that could be added.
-WNP78, your funk master.
oh heck yeah, very lovely. I'm a few years late to the party but thank you my good sir
@VoidGuardian Пр
@UkrainianAviator np
@VoidGuardian Thank You
@UkrainianAviator try WeaponSelected="weapon name" & ammo("weapon name")=5 ? 1 : 0
The missile name is a string value so you need to put the name in quotations.
What if I need to rotator open and missile activate when there is certain number of missiles left like 5 missiles left the 5th missile activating
@windshifter1
Well I know that ,but he said using that in FT , implying using {}in detacher,rocket etc. Where it dont have a purpose .........
@UssrLENIN {} is used for funky trees in places it would not normally be put. Such as text labels, it is expexting words but you want to put code so before and after your code you put {}
@CAS6041
No I think I know how brackets work 😕 but I don't use {} only (over(
No damned bodmas like[{(
@UssrLENIN the reason that i would need that is if u fire the rocket, a detacher release the seat, then when it reaches its apex,
a detacher releases the rocket, then the parachute opens.
@CAS6041 that's .... For texts .... In .?nie
WHAT?why would u need that ?
"{}" ? I have NEVER thought it is any use in an EJECTION seat.!????!!!!!!!1!1!1!!1!1!11!!1
@CAS6041 Bro ,some heads up ,u need to use "@" symbol before a guy's name to tage them making them get a notification that YOU have tagged HIM.
AND , wnp78 don't reply cause he's a main dev and as per I know , barely active in comments of this site
@CAS6041 Here is what my experiments brought forth. https://www.simpleplanes.com/a/bd5T8c/Aircraft-Rocket-Powered-Detacher-Seat
ill be online this afternoon
im good i just figured out u just need{} instead of ()
@CAS6041 Also to make someone aware you are asking them you write @ then the name
@CAS6041 I believe it is possible. There is a way to attach a detacher to a rocket so that when you fire the rocket, it stays connected. Attaching the seat as well. Then make the input of the detacher {FireWeapon}. I will experiment a bit and get back to you.
So WNP78, ive been building a ejection seat with rockets, could you make me a detacher that fires when you fire rocket?
@windshifter1 yeah do it it'll be better
@UssrLENIN I'll tag you if you agree.
@UssrLENIN Could you try actually testing it in the actual plane?
@UssrLENIN Sorry but it didn't work.
@windshifter1
Hmmm , give me sometime to think ,soo
Given :
{IDENT? (sin(Time-|asterisk or star symbol for multiply|-300)?hexa color code for yellow : hexa color code for green) : ""}
TRY IT . I just came up with it ......
No teste
And ofc if u wanna use ident as a custom group change button
_interactiontype_ to toggle and use IDENT instead of activate1 (these changes to be done in overload)
Aske me if have any questions.
@KtaAviation
Question mark (?) Is basically used in all codes like Java and xml for 1 function:
When the FT code inside the (?) Is true or outputs a value greater than 0 , the function 1 is executed,if not function 2 is executed.
Example: let's say I want something to open with AG1 ONLY when VTOL=1 ,so
VTOL=1? Activate1 : 0
Here 2 signs are important --
( ? ) And ( : )
Tell me if have any doubts or want specific code
@UssrLENIN Bow do you use the
?
function?