Hello everyone,
Snow here. I'm probably more excited about this update than any of you guys are. There are massive updates for Funky Trees, and we are approaching levels we couldn't ever think of before. Among other things, the one biggest change is variables.
If you've programmed at all before, you will see the incredible potential for this new change. For those not in the know, let me break down variables in detail for you.
- Variables in FT are assigned in a separate section of the aircraft XML file under <Variables>. In the designer, this is done by pressing on the new variables button, and a window appears:
Variables can be created here. - Variable assignment is done by entering a variable name on the left and the value of the variable on the right, and a priority of the variable (this will be explained in more detail later). Variable names can be really anything alphanumeric, but cannot start with a digit. Underscores are also accepted, use them for longerwordedvariables. Variables can be assigned a value of really any valid FT expression.
- Calling variables is simply done by referencing the variable name in another FT expression. For example, if I assign variable
banan
the value of13
, then when I dobanan + 1
, I will get14
. Variable calling can also be done in other variables as well, and they can be self-referenced. That is, take for example, variablex = 1
: if I redefine variablex
again asx = x + 1
, the value of the variable is taken first, and the assignment of the value to the variable happens. This behavior is identical to most programming languages. - Compiling & running variables are done when you load in your aircraft. By default, variables are initialized with the value of
0
. I can write down only the statementx = x + 1
and it will still work, but this is generally bad practice so try to declare your variables before using them. The variables are evaluated every physics tick, and the execution order of the variables is top-down in the variables window by default. If I havex = 1
on the first line andx=2
on the 2nd line, thex=1
is evaluated first but is overwritten asx=2
is the most recent value. If you referencex
in this case it will always equal2
. However, as it has a top-down evaluation order, I can use variablex
with another calculation with a different variable. For example, if my first line of variables isx=1
, 2nd liney = x
, and third linex = 4
, then the final result will evaluate toy=1
andx=4
. I can see some good use in this behavior. - Variable priority. These are the numbers on the far right the determine the priority of the variable. These are mostly relevant to the compiling & running of variables: if I have my first variable as
x=1
with priority 1, andx=2
with priority 0, the result will be 0 because a variable "setter" of lower priority cannot overwrite one with higher priority. This won't be of much concern to most people, but one use I can think of is to basically create ghettoconst
s that have high priority such that I don't change it by accident. - Variable activation groups. Although not in the UI yet, these can be set via XML. Variable setters can be assigned activation groups, which will act like any other part with an activation group. The variable will run and compile only when it is on, and if the activation group is turned off, the variable will stop evaluating, and be temporarily removed from the list of variables. That also means if a variable is assigned a value two times, and the higher-priority variable is turned off, the lower-priority version of the variable will begin to show.
This is about it for the moment. If I can gather anything new about the properties of variables, I may update this post, but expect some massive changes to be coming into the funky guide. Stay tuned!
@Jandy I know I'm 9 months too late, but unfortunately you can't. If you try and make a variable in the variable setters called FireWeapons, for example, it will either have an error or just make a new variable of the same name (either way it won't do what you want).
@SnoWFLakE0s @PlanariaLab @WNP78 is it possible to use the variable system to influence "default" variables such as FireWeapons? Say I dont want to use a button set to FireWeapons and instead want to use a button for multiple purposes?
ex:
FireWeapons =
B1=1?true:false
but at the same time
CycleTargetingMode =
B1=0?true:false
like have a custom variable with the same name as a default variable which would in turn effect the default variable? ive tried this in game but I cant seem to get it to work.
edit: by default variable I mean:
Pitch
Roll
Yaw
Throttle
Brake
Trim
VTOL
LandingGear
FireGuns
FireWeapons
LaunchCountermeasures
Activate1
Activate2
Activate3
Activate4
Activate5
Activate6
Activate7
Activate8
How to use "air to air" mode for input rotator :-)
@PlaneFlightX
.
Strangely enough a lot of people don't seem to be knowledgeable on inverse trig nomenclature. Arc or a notation is about as common as inverse notation in my experience, so that's very strange to me.
I have a completely unrelated question:
.
I am working on making a working ILS system using trigonometry, and I am wondering if sin-1 (inverse sin), as well as other trig functions (tan-1, cos-1 etc.) are in the game. I had my information ready, was about to write the code, and then noticed the absence of sin-1, tan-1, cos-1 from the Funky Trees Guide. I'm not sure why these aren't in the game. Can you please help me?
EDIT:
After investigating further I realized asin/acos/atan are that same function, but worded differently.
I'd recommend slightly updating the FT guide to show this (Instead of "The arc-sine of x (degrees), say "The arc-sine (inverse sine) of x (degrees)").
@PlaneFlightX
.
I can't make any promises, but at least not long after 1.11 is out of beta. A lil' busy with schoolwork.
When will the funky guide updates go live? I understand you kinda have to write them, explain them, and do other formatting stuff, but I'm just wondering.
tries to put the whole Assetto Corsa physics into SP
@tomlin5412
.
Just a note: SP (Unity) uses 9.81 flat.
me a FTer:
define G=9.80665 in every aircraft uses G limiter and cannon fire control system
as somebody who doesn't even know what cos or sin is on a calculator, i'm just like
mind blows up into a supernova
banan
Dude I had no idea they added this! I can finally put my programming know-how to proper work! And Im sure you'll go off and make a supercomputer with this lmao, or maybe Microsoft Flight Simulator X remade in Sp?
Seriously this opens up so many options for builds
You know what this means, right?
laughs in 1 to 1 chernobyl reactor four simulators
nice