Profile image

"Master Funky Trees in SimplePlanes: Essential Tips for Beginners!"

1,277 Khichi2866  20 days ago

Mathematical Operations in SimplePlanes

Addition (+) and Subtraction (-)

Addition (+)

Addition combines two values together.

Example:
speed + 10
- This adds 10 to the speed. If the speed is 100, then it becomes 110.

Subtraction (-)

Subtraction removes one value from another.

Example:
altitude - 5
- This subtracts 5 from the altitude. If the altitude is 1000, then it becomes 995.

Where to use in SimplePlanes:
Use these operations in systems like Throttle or Altitude control, adjusting values over time.


Unary Minus (-)

The unary minus operation simply changes the sign of a number.

Example:
-Pitch
- If Pitch = 30, then -Pitch will turn it into -30.

Where to use in SimplePlanes:
Use this to reverse the direction of movement, like flying upside down.


Multiplication (*) and Division (/)

These operations scale values.

Multiplication (*)

Multiplication increases or scales a value.

Example:
throttle * 2
- If throttle = 50, multiplying by 2 gives 100.

Division (/)

Division reduces a value.

Example:
altitude / 2
- If altitude = 1000, dividing by 2 gives 500.

Where to use in SimplePlanes:
These can be used to adjust values like engine power or fuel consumption.


Comparison Operators

Less Than (<) and Greater Than (>)

Less Than (<)

Checks if one value is smaller than another.

Example:
altitude &lt; 500
- If altitude = 300, it returns true.

Greater Than (>)

Checks if one value is larger than another.

Example:
speed > 100
- If speed = 120, it returns true.

Where to use in SimplePlanes:
Use these for triggering actions like landing gear or emergency systems.


Less Than or Equal To (<=) and Greater Than or Equal To (>=)

Less Than or Equal To (<=)

Checks if a value is smaller than or equal to another.

Example:
altitude &lt;= 500
- If altitude = 500, it returns true.

Greater Than or Equal To (>=)

Checks if a value is greater than or equal to another.

Example:
speed >= 200
- If speed = 200, it returns true.

Where to use in SimplePlanes:
Use these comparisons to trigger systems based on thresholds like autopilot or engine modes.


Equal To (==) and Not Equal To (!=)

Equal To (==)

Checks if two values are exactly the same.

Example:
speed == 100
- If speed = 100, it returns true.

Not Equal To (!=)

Checks if two values are different.

Example:
altitude != 500
- If altitude = 300, it returns true.

Where to use in SimplePlanes:
Use for precise conditions, like triggering an event when values are exactly equal or not equal to a set number.


Boolean (Logical) Operators

AND (&)

The AND operator requires both conditions to be true.

Example:
(speed > 100) &amp; (altitude > 1000)
- This returns true only if both conditions are met: speed greater than 100 and altitude greater than 1000.

Where to use in SimplePlanes:
Use to activate systems when multiple conditions are true, like turning on afterburners.


OR (|)

The OR operator requires at least one condition to be true.

Example:
(altitude > 1000) | (speed > 200)
- This returns true if either condition is met: altitude above 1000 or speed above 200.

Where to use in SimplePlanes:
Use this for systems that activate when any one condition is true, like engaging airbrakes.


NOT (!)

The NOT operator reverses the condition.

Example:
!(altitude > 500)
- If altitude > 500 is true, it turns into false.

Where to use in SimplePlanes:
Use this to negate conditions, like turning off systems if certain criteria are met.


Ternary Operator

The ternary operator helps you choose between two values based on a condition.

Syntax:
condition ? value_if_true : value_if_false

Example:
(altitude > 500) ? "Above" : "Below"
- If altitude = 600, it returns "Above".
- If altitude = 400, it returns "Below".

Where to use in SimplePlanes:
Use this for quick decisions in scripts, such as changing text on the HUD based on altitude or speed.


Useful Math Functions

abs(x) – Absolute Value

The absolute value removes the negative sign of a number.

Example:
abs(-10)
- This returns 10.

Where to use in SimplePlanes:
Use this to calculate distances or forces where direction doesn't matter.


ceil(x) – Round Up

Rounds a number up to the nearest whole number.

Example:
ceil(3.2)
- This returns 4.

Where to use in SimplePlanes:
Useful for rounding altitude or speed values to the nearest integer.


clamp(x, min, max) – Limit a Value

Clamps a value to stay between a minimum and maximum range.

Example:
clamp(10, 0, 5)
- This returns 5, as 10 exceeds the maximum value.

Where to use in SimplePlanes:
Prevent values like speed or altitude from exceeding specific limits.


lerp(a, b, t) – Linear Interpolation

The lerp function smoothly interpolates between two values.

Example:
lerp(0, 100, 0.5)
- This returns 50, the midpoint between 0 and 100.

Where to use in SimplePlanes:
Great for smooth transitions in throttle or control surfaces.


round(x) – Round to Nearest Integer

Rounds a number to the nearest integer.

Example:
round(4.7)
- This returns 5.

Where to use in SimplePlanes:
Used to round speed or altitude values to whole numbers.


These operations and functions are the core of scripting in SimplePlanes, allowing you to create dynamic flight systems and custom behavior for your planes. Play around with these and see how they can improve your creations!

  • Log in to leave a comment
  • Profile image
    1,277 Khichi2866

    AI Generated

    Pinned 20 days ago
  • Profile image

    @L1nus Okay.

    19 days ago
  • Profile image
    1,277 Khichi2866

    @Dissent3R
    I did the same thing you did in the video

    19 days ago
  • Profile image
    1,277 Khichi2866

    @Dissent3R
    Ok 👌
    I will give it a try

    +1 19 days ago
  • Profile image

    @Khichi2866
    How to use these funky trees

    +1 19 days ago
  • Profile image
    34.8k Dissent3R

    Also check this video I made, shows that it isn't perfect but you can get an idea of the code you're looking for. Better still just learn it like the rest of us, the whole AI with gpt thing is just a fun idea I and some others had, you'd realise it's a whole lot easier to just do it yourself

    +1 19 days ago
  • Profile image
    34.8k Dissent3R

    You can't just ask AI about FT without previous explanation inputs. Even then relying solely on it would leave you frustrated. Like many have said, just learn it, it'd be worthwile

    +2 19 days ago
  • Profile image

    One of the operators is wrong for FT btw, guess chat has some obscure programming language learning to do

    19 days ago
  • Profile image
    114k L1nus

    @Firecharge123 that's well known HTML writing, FT on the other hand is a specific language only used in Simple planes

    19 days ago
  • Profile image
    114k L1nus

    @Khichi2866 AI has yet to make working FT label huds, i bet you're one of those kids who religiously uses GPT to look up stuff instead of using google like a normal person

    19 days ago
  • Profile image
    1,277 Khichi2866

    @Firecharge123
    @L1nus
    AI knows everything.

    19 days ago
  • Profile image

    How does the AI know markdown formatting?

    19 days ago
  • Profile image
    114k L1nus

    @Khichi2866 Ai doesn't understand FT so why would you even use AI for that purpose

    19 days ago
  • Profile image
    1,277 Khichi2866

    @SILVERPANZER
    @crazyplaness
    Thanks, if you find any mistake please do consider to comment it out..

    19 days ago
  • Profile image

    @Khichi2866 I’m not mad

    19 days ago
  • Profile image
    54.6k SILVERPANZER

    By the way, Pitch and Throttle cannot be 30 and 50 (unless anything is added to it, for example multiplying by 100), Pitch, Roll, Yaw, Trim and VTOL have a range from -1 to 1, and Throttle and Brake have a range from 0 to 1.

    19 days ago
  • Profile image
    1,277 Khichi2866

    @crazyplaness
    Yes
    It make things easy for me 😁😁😁

    And you are not mad right

    20 days ago
  • Profile image

    100% AI Generated
    even the pinned comment is AI generated
    Also, it’s called funky trees, not “The funky tree”

    +1 20 days ago