Profile image

how do i make an “if” with funky trees

17.1k Convex  3 months ago

like, for example; [input] only works if speed 0

  • Log in to leave a comment
  • Profile image

    @satgat Yes, but you should use parenthesis.
    Throttle>0 ? (VTOL>0.5 ? Throttle : 0) : 0

    3 months ago
  • Profile image
    7,880 satgat

    @HuskyDynamics01 can I use it multiple times?
    I mean, like this:

    Throttle>0 ? VTOL>0.5 ? Throttle : 0 : 0

    3 months ago
  • Profile image
    8,866 Sockdragger

    As said by the other posters: Funkytrees has an if -function in the form a?b:c
    This is a conditional formula that returns b if a id true and c otherwise.
    For instance:
    <Rotator input> is VTOL>0.5 ? Throttle:0 returns the value of Throttle if the VTOL slider is pushed higher than 0.5 , and 0 otherwise.

    If you want your input to be <x> when the ground speed is 0 and 0 otherwise, you can try:
    <Input> is GS=0? X:0

    Although you might get better results with
    <Input> is GS<3? X:0

    (Ground speed is measured in M/s, which is roughly half of MPH and 3.6 times KmH. So GS<3 would correspond with 6mph/10kmh.

    3 months ago
  • Profile image
    17.1k Convex

    @HuskyDynamics01 @OverlordPrime thanks!

    +2 3 months ago
  • Profile image

    itemToCheck ? doIfYes : doIfNo

    For example, if you wanted the output to read "Blue" when the throttle is at 100%, and "Red" if it isn't, you would use:
    Throttle=1 ? Blue : Red
    (note that "blue" and "red" aren't actually valid FT expressions, but they work as an example).
    In your case, you'd have something like:
    GS<1 ? [input] : 0
    Don't use GS=0 - it's almost impossible to make your craft be perfectly stationary since the game checks speed down to like eight decimal places or something. GS (the ground speed variable) is in meters per second, so you could check for it to be less that 0.5, 0.1, etc. depending on how "stopped" you want to be for the input to work.

    +2 3 months ago
  • Profile image

    Speed = 0 ? Output : output

    3 months ago