Math Commands: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "^#redirect \[\[" to "#REDIRECT [[")
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
==Math Commands==
#REDIRECT [[:Category:Command Group: Math]]
'''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.'' [[Number#Radians|Radians]], [[Number#Degrees|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 <tt>0.0</tt> and <tt>1.0</tt> (''e.g.'' no <tt>''integer'' &gt; 1</tt> 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:<code>a = [[abs]] -3;<br>? (a) : [[exit]];</code>
 
;Good:<code>? (a > 0) : [[exit]];</code>
 
<div style="-webkit-column-count:6;-moz-column-count:6;column-count:6;">
* [[abs]]
* [[acos]]
* [[asin]]
* [[atan]]
* [[atan2]]
* [[atg]]
* [[ceil]]
* [[cos]]
* [[deg]]
* [[exp]]
* [[floor]]
* [[ln]]
* [[log]]
* [[min]]
* [[max]]
* [[mod]]
* [[pi]]
* [[rad]]
* [[random]]
* [[round]]
* [[sin]]
* [[sqrt]]
* [[tan]]
</div>
 
==Commands Introduced with Arma 3 v1.22==
In {{GVI|arma3|1.22}} the following math commands were added to simplify vector management. See [http://forums.bistudio.com/showthread.php?160330-Scripting-Discussion-(dev-branch)&p=2700462&viewfull=1#post2700462 this post] for more information.
 
Returning an [[Array]]:
* [[vectorAdd]]
* [[vectorCrossProduct]]
* [[vectorDiff]]
* [[vectorDistance]]
* [[vectorDistanceSqr]]
* [[vectorMultiply]]
 
Returning a [[Number]]:
* [[vectorCos]]
* [[vectorDotProduct]]
* [[vectorMagnitude]]
* [[vectorMagnitudeSqr]]
 
==Relatia==
*[[Number#Degrees|Degrees]]
*[[Number#Radians|Radians]]
*[[Operators]]
*[[count]]
*[[distance]]
 
[[Category: Scripting Topics]]

Latest revision as of 00:03, 25 June 2022