Math Commands: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (tidying)
(Added the new (A3 v1.22) math commands, but am not an article creator. NEEDS WORK.)
Line 1: Line 1:
==Math Commands==
'''All''' of these commands work with ''and/or'' return a generic type [[Number]].
'''All''' of these commands work with ''and/or'' return a generic type [[Number]].


Line 13: Line 14:
;Good:<code>? (a > 0) : [[exit]];</code>
;Good:<code>? (a > 0) : [[exit]];</code>


==Commands==
<div style="-webkit-column-count:6;-moz-column-count:6;column-count:6;">
<div style="-webkit-column-count:6;-moz-column-count:6;column-count:6;">
*[[abs]]
* [[abs]]
*[[acos]]
* [[acos]]
*[[asin]]
* [[asin]]
*[[atan]]
* [[atan]]
*[[atan2]]
* [[atan2]]
*[[atg]]
* [[atg]]
*[[ceil]]
* [[ceil]]
*[[cos]]
* [[cos]]
*[[deg]]
* [[deg]]
*[[exp]]
* [[exp]]
*[[floor]]
* [[floor]]
*[[ln]]
* [[ln]]
*[[log]]
* [[log]]
*[[min]]
* [[min]]
*[[max]]
* [[max]]
*[[mod]]
* [[mod]]
*[[pi]]
* [[pi]]
*[[rad]]
* [[rad]]
*[[random]]
* [[random]]
*[[round]]
* [[round]]
*[[sin]]
* [[sin]]
*[[sqrt]]
* [[sqrt]]
*[[tan]]
* [[tan]]
</div>
 
==Commands Introduced with Arma 3 v1.22==
In {{GVI|arma3|1.22}} these new math commands were added [http://forums.bistudio.com/showthread.php?160330-Scripting-Discussion-(dev-branch)&p=2700462&viewfull=1#post2700462 to simplify stuff ppl do].{{Clarify}}
 
Returning an [[Array]]:
<div style="-webkit-column-count:6;-moz-column-count:6;column-count:6;">
*[[vectorAdd]]
*[[vectorDiff]]
*[[vectorDistance]]
*[[vectorDistanceSqr]]
*[[vectorMultiply]]
*[[crossProduct]]
</div>
 
Returning a [[Number]]:
<div style="-webkit-column-count:6;-moz-column-count:6;column-count:6;">
*[[dotProduct]]
*[[vectorCos]]
*[[vectorMagnitude]]
*[[vectorMagnitudeSqr]]
</div>
</div>



Revision as of 04:20, 1 June 2014

Math Commands

All of these commands work with and/or return a generic type Number.

In the scripting language (unlike config's) there is no specialty types such as float or integer. All numeric values are represented solely as a Number type.

However, specific commands listed below expect specific types of value e.g. Radians, Degrees, and floats.

Be aware that although not directly related to the list below many commands in the scripting language restrict the range of possible values. Particularly commands wanting ratios between 0.0 and 1.0 (e.g. no integer > 1 is possible). Check individual documentation for the command itself.

Also, the Boolean is a true type in command syntax. The results (the return value) of the below list should not be used directly in a boolean type expression(s).

Bad
a = abs -3;
? (a) : exit;
Good
? (a > 0) : exit;

Commands Introduced with Arma 3 v1.22

In Arma 3 logo black.png1.22 these new math commands were added to simplify stuff ppl do.Clarify

Returning an Array:

Returning a Number:

Relatia