Simple Expression: Difference between revisions
Jump to navigation
Jump to search
(original "factor" statement had the zero misplaced and was very misleading as a result; also more descriptive now) |
(New function interpolate) |
||
Line 13: | Line 13: | ||
Note: works fine even for ''x''>''y'' (calculated as 1-''a'' factor [''y'',''x'']) | Note: works fine even for ''x''>''y'' (calculated as 1-''a'' factor [''y'',''x'']) | ||
|- | |||
| ''a'' intepolate [''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'' min ''b'' || see [[min]] |
Revision as of 11:13, 4 December 2009
Simple expressions are not as flexible as normal scripts, but they are compiled for a very efficient execution.
Folowing 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 intepolate [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 |
Description: a,b can be any simple expression. x,y can be a constant expression only (i.e. expression with a type Number).