BIS fnc roundDir: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Page filling) |
m (template:command argument fix) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Round direction to nearest set rounding; used for determining cardinal direction. |= | | Round direction to nearest set rounding; used for determining cardinal direction. |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [rawDirection, rounding] call [[BIS_fnc_roundDir]] |= | | [rawDirection, rounding] call [[BIS_fnc_roundDir]] |SYNTAX= | ||
|p1= rawDirection: [[Number]] - direction to round |= | |p1= rawDirection: [[Number]] - direction to round |PARAMETER1= | ||
|p2= rounding: [[Number]] - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270. |= | |p2= rounding: [[Number]] - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270. |PARAMETER2= | ||
| [[Number]] - rounded direction, depending on input '''can be negative or over 360''' |= | | [[Number]] - rounded direction, depending on input '''can be negative or over 360''' |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>[[player]] [[setDir]] (<nowiki>[</nowiki>[[getDir]] [[player]], 45] [[call]] [[BIS_fnc_roundDir]]);</code> |= | |x1= <code>[[player]] [[setDir]] (<nowiki>[</nowiki>[[getDir]] [[player]], 45] [[call]] [[BIS_fnc_roundDir]]);</code> |EXAMPLE1= | ||
|x2= <code>[204.2, 10] [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 200}}</code> |= | |x2= <code>[204.2, 10] [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 200}}</code> |EXAMPLE2= | ||
|x3= <code>[271, 180] [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 360}}</code> |= | |x3= <code>[271, 180] [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 360}}</code> |EXAMPLE3= | ||
|x4= <code>70 [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 90}}</code> |= | |x4= <code>70 [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 90}}</code> |EXAMPLE4= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[setDir]], [[getRelDir]], [[round]] |= | | [[setDir]], [[getRelDir]], [[round]] |SEEALSO= | ||
}} | }} | ||
Revision as of 14:33, 7 April 2019
Description
- Description:
- Round direction to nearest set rounding; used for determining cardinal direction.
- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [rawDirection, rounding] call BIS_fnc_roundDir
- Parameters:
- rawDirection: Number - direction to round
- rounding: Number - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270.
- Return Value:
- Number - rounded direction, depending on input can be negative or over 360
Examples
- Example 1:
player setDir ([getDir player, 45] call BIS_fnc_roundDir);
- Example 2:
[204.2, 10] call BIS_fnc_roundDir; // will return 200
- Example 3:
[271, 180] call BIS_fnc_roundDir; // will return 360
- Example 4:
70 call BIS_fnc_roundDir; // will return 90
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note