Simple Expression: Difference between revisions
Killzone Kid (talk | contribs) |
Lou Montana (talk | contribs) m (Text replacement - "[[Image:" to "[[File:") |
||
Line 28: | Line 28: | ||
| abs ''a'' || see [[abs|abs]] (introduced in Arma 3 patch 1.68) | | abs ''a'' || see [[abs|abs]] (introduced in Arma 3 patch 1.68) | ||
|- | |- | ||
| x envelope [a,b,c,d] || trapezoid envelope with output <0;1> (substitution for "(v factor(a,b))*(v factor(d,c))" (Since Arma 3 1.67) <br><br> [[ | | x envelope [a,b,c,d] || trapezoid envelope with output <0;1> (substitution for "(v factor(a,b))*(v factor(d,c))" (Since Arma 3 1.67) <br><br> [[File:envelope.jpg|left|thumb|envelope graph]] | ||
|- | |- | ||
| ''a'' > ''b'' || see [[a_greater_b|a > b]]. Returns 1 and 0 rather than true and false. | | ''a'' > ''b'' || see [[a_greater_b|a > b]]. Returns 1 and 0 rather than true and false. |
Revision as of 23:10, 20 November 2023
Available Operators
randomGen a | random value from 0 to a (randomGen 5) |
randomGen expr | random value from 0 to expression value (randomGen daylight) |
a factor [x,y] | factor is the same as interpolate only output range is fixed and capped to 0...1 (or 1...0 if input range is reversed)
|
a interpolate [xFrom,xTo,resFrom,resTo] | Introduced in Arma 2 1.05. interpolate result based on input value.
Equivalent to x factor [xFrom,xTo] * (resTo-resFrom) + resFrom |
a min b | see min |
a max b | see max |
a - b | see a-b |
a + b | see a+b |
a * b | see a*b |
a / b | see a/b (for A3, not sure if others) |
abs a | see abs (introduced in Arma 3 patch 1.68) |
x envelope [a,b,c,d] | trapezoid envelope with output <0;1> (substitution for "(v factor(a,b))*(v factor(d,c))" (Since Arma 3 1.67) |
a > b | see a > b. Returns 1 and 0 rather than true and false. |
a < b | see a < b. Returns 1 and 0 rather than true and false. |
a >= b | see a >= b. Returns 1 and 0 rather than true and false. |
a <= b | see a <= b. Returns 1 and 0 rather than true and false. |
Description: a,b can be any simple expression. x,y can be a constant expression only (i.e. expression with a type Number).
Since Arma 3 1.67 the following operators are also available (v ... controller value):
- abs(v) - absolute value
- sqr(v) - square value
- sqrt(v) - square root value
- pow(v, a) - power
SQF Equivalent of factor
Example:
SQF Equivalent of interpolate
Example:
SQF Equivalent of envelope
Example:
Simple Expressions - How do they work?
The following is an example taken from the Eden Editor: Entity Context Menu.
Example:
conditionShow = "hoverObjectCanFly * (1 - hoverObjectFlying)";
Entry will only show if the object you are hovering over can fly and the object isn't flying.
Let's take a closer look at the example.
hoverObjectCanFly and hoverObjectFlying are two boolean values, which can either be true (1) or false (0).
If hoverObjectCanFly is true (1) and hoverObjectFlying is false (0) the resulting equation looks like this:
1 * (1-0) = x 1 * 1 = x x = 1
The result will be true (1), therefore the entry will be shown.