Simple Expression: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(added abs preliminary, based on dev branch log)
mNo edit summary
Line 29: Line 29:
| ''a'' / ''b'' || see [[a_/_b|a/b]] (for A3, not sure if others)
| ''a'' / ''b'' || see [[a_/_b|a/b]] (for A3, not sure if others)
|-
|-
| abs ''a'' || see [[abs|abs]] (A3 post 1.66 update only)
| abs ''a'' || see [[abs|abs]] (introduced in Arma 3 patch 1.68)
|}
|}


Description: ''a'',''b'' can be any simple expression. ''x'',''y'' can be a constant expression only (i.e. expression with a type [[Number]]).
Description: ''a'',''b'' can be any simple expression. ''x'',''y'' can be a constant expression only (i.e. expression with a type [[Number]]).

Revision as of 19:25, 25 January 2017


Simple expressions are not as flexible as normal scripts, but they are compiled for a very efficient execution.

Following operators are available:


randomGen a random value from 0 to a
a factor [x,y] a<=x: 0
a>=y: 1
x<=a<=y: ratio between x and y

Note: works fine even for x>y (calculated as 1-a factor [y,x])

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)

Description: a,b can be any simple expression. x,y can be a constant expression only (i.e. expression with a type Number).