BIS fnc decodeFlags4: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - " {2,}\}\}" to " }}")
No edit summary
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function
{{RV|type=function


| arma3
|game1= arma3
|version1= 1.00


|1.00
|gr1= Bitwise


|gr1 = Bitwise
|descr= Decodes a single scalar into array of unique 4-state flags (values 0,1,2,3).


<!---|arg= local |Multiplayer Arguments=--->
|s1= [encodedFlags, size] call [[BIS_fnc_decodeFlags4]]


<!---|eff= local |Multiplayer Effects=--->
|p1= encodedFlags: [[Number]] - non-decimal number between 0 and 16777215
|p2= size: [[Number]] - (Optional, default -1) output size. Size -1 means output will not be resized


| <pre>/*
|r1= [[Number]] - decoded flags
Decodes a single scalar into array of unique 4-state flags (values 0,1,2,3). Max. number that can be decoded is 16777215 (= 4^12 - 1). An optional parameter can by supplied to resize the output.


Syntax:
|x1= <sqf>private _decodedFlags = 225 call BIS_fnc_decodeFlags4; // [1,0,2,3]</sqf>
-------
|x2= <sqf>private _decodedFlags = [225, 8] call BIS_fnc_decodeFlags4; // [1,0,2,3,0,0,0,0]</sqf>
_flags:array = _encodedFlags:scalar call bis_fnc_decodeFlags4;
_flags:array = [_encodedFlags:scalar,_size:scalar] call bis_fnc_decodeFlags4;


Example:
|seealso= [[BIS_fnc_encodeFlags4]]
--------
[1,0,2,3] = 225 call bis_fnc_decodeFlags4;
[1,0,2,3,0,0,0,0] = [225,8] call bis_fnc_decodeFlags4;
 
Explanation:
------------
225 -> 11 10 00 01 -> [1,0,2,3]
*/</pre>{{placeholder}}<!-- Remove this after fill-in -->
 
|[] call [[BIS_fnc_decodeFlags4]]
 
|p1= parameter: Datatype - (Optional, default defValue) description
 
|Datatype - description
 
|x1= <code></code>
}}
}}
[[Category:Functions|{{uc:decodeFlags4}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:decodeFlags4}}]]

Latest revision as of 20:40, 24 June 2025

Hover & click on the images for description

Description

Description:
Decodes a single scalar into array of unique 4-state flags (values 0,1,2,3).
Execution:
call
Groups:
Bitwise

Syntax

Syntax:
[encodedFlags, size] call BIS_fnc_decodeFlags4
Parameters:
encodedFlags: Number - non-decimal number between 0 and 16777215
size: Number - (Optional, default -1) output size. Size -1 means output will not be resized
Return Value:
Number - decoded flags

Examples

Example 1:
private _decodedFlags = 225 call BIS_fnc_decodeFlags4; // [1,0,2,3]
Example 2:
private _decodedFlags = [225, 8] call BIS_fnc_decodeFlags4; // [1,0,2,3,0,0,0,0]

Additional Information

See also:
BIS_fnc_encodeFlags4

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