Profile image

Funky Trees - Notes for 1.11

66.6k SnoWFLakE0s  2.6 years ago

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.

  1. 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.
  2. 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.
  3. Calling variables is simply done by referencing the variable name in another FT expression. For example, if I assign variable banan the value of 13, then when I do banan + 1, I will get 14. Variable calling can also be done in other variables as well, and they can be self-referenced. That is, take for example, variable x = 1 : if I redefine variable x again as x = 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.
  4. 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 statement x = 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 have x = 1 on the first line and x=2 on the 2nd line, the x=1 is evaluated first but is overwritten as x=2 is the most recent value. If you reference x in this case it will always equal 2. However, as it has a top-down evaluation order, I can use variable x with another calculation with a different variable. For example, if my first line of variables is x=1, 2nd line y = x, and third line x = 4, then the final result will evaluate to y=1 and x=4. I can see some good use in this behavior.
  5. 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, and x=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 ghetto consts that have high priority such that I don't change it by accident.
  6. 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!

  • Log in to leave a comment
  • Profile image
    46.5k PlaneFlightX

    @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).

    one month ago
  • Profile image
    2 Jandy

    @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

    +2 11 months ago
  • Profile image
    1,906 Lanta1024

    How to use "air to air" mode for input rotator :-)

    +3 1.6 years ago
  • Profile image
    66.6k SnoWFLakE0s

    @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.

    +3 2.5 years ago
  • Profile image
    46.5k PlaneFlightX

    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)").

    +1 2.5 years ago
  • Profile image
    66.6k SnoWFLakE0s

    @PlaneFlightX
    .
    I can't make any promises, but at least not long after 1.11 is out of beta. A lil' busy with schoolwork.

    +1 2.6 years ago
  • Profile image
    46.5k PlaneFlightX

    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.

    2.6 years ago
  • Profile image
    8,938 LowtusF139

    tries to put the whole Assetto Corsa physics into SP

    +2 2.6 years ago
  • Profile image
    66.6k SnoWFLakE0s

    @tomlin5412
    .
    Just a note: SP (Unity) uses 9.81 flat.

    2.6 years ago
  • Profile image

    me a FTer:
    define G=9.80665 in every aircraft uses G limiter and cannon fire control system

    +1 2.6 years ago
  • Profile image

    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

    2.6 years ago
  • Profile image

    banan

    2.6 years ago
  • Profile image
    4,038 YoDudeChase

    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?

    +3 2.6 years ago
  • Profile image

    Seriously this opens up so many options for builds

    +3 2.6 years ago
  • Profile image

    You know what this means, right?

    laughs in 1 to 1 chernobyl reactor four simulators

    +2 2.6 years ago
  • Profile image
    19.0k klm747klm747

    nice

    2.6 years ago