This post has information useful for those using the 1.9 beta.
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.
First, you can do everything you used to be able to. The new system will only be activated if the input doesn't fit the old system, so all old builds should remain functional.
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.
Hi! Faced the problem of high frequency noise in the control system at low speeds (about 0-20 kmh). I should make a low pass filter, but I have no idea how to make it. Or is it possible to solve the problem differently? This noise does not really interfere, but rather just annoys with constant twitching of surfaces. Thank you!
@linxiaofeng2339
not what I am looking for,
I want it to be specific (negative and positive vectors), but all speed data can't go in the negatives, only calculates the speed, not vector
(Z+ is forward, Z- is Backward)
I was planning to use latitude and longitude and heading the get precise Z vectors for all directions
@ProjectVideoGame Input:
x*(IAS(or TAS or GS)>----?1:0)
@nicolascolissi14 Input:
Throttle*(Throttle<90?1:0)
@Junkers87 No .
@Dimassas9988 так это и есть страница с документацией. если хочешь понять, что написано, то учи английский
Помогите дайте команды синтаксис и слова для программирования деталей моего самолета
I don’t know how to but you can change the lifespan of said projectile, the time is in seconds, the way I find out the “lifetime” (range) of a weapon is by looking up how fast said ammo is, set that to the weapon(don’t forget to convert measurements),divide the answer by the range of the irl weapon, and then divide it by 60(or something like that) to get the realistic range of a weapon, I did it and I got a lifespan of 17.6904755 seconds at a velocity of 840 m/s@OPaiTaOn
I'm not sure if this is still open to suggestions, but it says so in the post so here goes: what about a "sensor" part that can collect additional flight data similar to a cockpit block, and have an ID of some sort, then a function to retrieve the data, something like: flightdata(x, y) where x is the flight data you want from the sensor with ID of y. This could open up a variety of new things not possible before, and even create the ability to make user-defined variables.
how can i make a cannon projectile detonate by proximity? I want to make a flak 88
@Urocyon (Time = (Wanted time in seconds)) would probably do it.
Dunno about the actual time of day though
Is there a way to make lights activate due to time of day?
is there any way to make countermeasure dispensers fire on the fireGuns input?
if not is there any way to put the guns on the launchCountermeasures input?
Honestly after playing around quite a bit with your "Funky trees" xml scripting language, i find that it adds a lot to the game. It's possible to create things that are much more advanced than ye old days of putting throttle as a rotor's input.
As FT stands now it's a really useful tool to calculate trajectories or for very simple condition logic. But i think the one thing it lacks is a reliable way to store information. I have been able to overcome this limit by using canons and other weapons as input and memory devices (by reading their ammo count).
It would be incredible if you could add a method to store a numerical value somewhere. Either that or some way to use the fire command and select a weapon from FT (that would enable the code to lower values by itself, by shooting multiple times).
That or some kind of sound block would be an amazing add to this game.
Anyways thanks for reading and for giving us FT :)
As I know Pi Is Equivalent To 3.14159265359 Or simply 3.14.
How do I get the Z(Front and Back) Vector? I wanna make my flying rover very stable during flight, my rover has an x(Anti side Slip) and y(Altitude Hold) vector stabilizers, but I don't have z
@onyx63 sadly that's not a thing at the moment. But if you want to model the spooling of an engine you could try using the
smooth(Throttle,
function with a time that is an estimate for how long the engine takes to spool. Another approach could be to measure the rate of fuel depletion:rate(-Fuel)
however this doesn't seem to provide a very precise result since the fuel depletes in very small steps.Is it possible to get information from a component of the plane? Like in the input of an engine i have a specific smoothing function, and a light that reflect the state of the engine (warmup, on, off).
Something along the lines of :
(partID.Input) as the value of the function that's inside the input of the part, here a smoothing function.
with the value of the input of this part?
WNP78 incredible, a quick response from the dev himself :)
Thanks for directing me to this doc, it'll come in handy.
@onyx63 it's a language I made from scratch. It doesn't really support code like a scripting language, only "single-line" expressions. There is a nice community made guide here if this post isn't enough.
sorry to bother you guys, i'm trying to automate parts of my craft and i was wondering if there was a more complete documentation about scripting in SP?
Like, how i can setup logic in my input (if that do this)...?
Edit: what scripting langage is this? Is it something that exists outside of SP or did you make it yourselves? Looks like AS3 but i wanna be sure
when i lock on to a target the rotators move to target, but i switch target it goes the away from it. And I realized that the way the cockpit is facing affect where the rotators target. how do I fix this.
So, is there a way to make countermeasures fire as soon as anything gets a lock on you?
Aaaaaa this is too much for my brain
@Grey1 https://www.simpleplanes.com/Mods/View/524146/Overload