BIS fnc invCodeToArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
m (Text replacement - ">\[ +(.*) *\] +(call|spawn)" to ">[$1] $2")
 
(44 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2
____________________________________________________________________________________________
|version1= 1.00


| arma2 |= Game name
|game2= arma2oa
|version2= 1.50


|1.00|= Game version
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| <pre>
|game4= arma3
/*
|version4= 0.50
File: fn_invSlotsEmpty.sqf


Description:
|gr1= Inventory
Converts inventory code (used in configs) to array with numbers for weapons and magazines (and their counts).
Parameter(s):
1: <scalar | empty> config code
Returns:
<array> items (slots) numbers
Function:
input (result of): [1  +  4  + 12*  256  + 2* 4096  +  2  + 8* 16  + 12*131072]
output: [1,1,1,8,12,2,0,12]
  - means: 1 x WeaponSlotPrimary, 1 x WeaponSlotHangun, ... , 12 x WeaponSlotInventory
 
input: []
output: [0,0,0,0,0,0,0,0]


*/
|descr=Converts inventory code (used in configs) to array with numbers for weapons and magazines (and their counts).


|s1= [configCode] call [[BIS_fnc_invCodeToArray]]


//returned array gives numbers of following:
|p1=configCode: [[Number]] - config code, see example
//mirrored from core config: cfg\Bin\cfgWeapons.hpp
#define WeaponSlotPrimary        1        // primary weapons
#define WeaponSlotHandGun        2        // HandGun
#define WeaponSlotSecondary        4        // secondary weapons
#define WeaponSlotHandGunItem        16 // HandGun magazines
#define WeaponSlotItem                256        // items
#define WeaponSlotBinocular        4096        // binocular
#define WeaponHardMounted        65536
#define WeaponSlotInventory 131072 // inventory items


|r1= [[Array]] of [[Number]]s - items slots numbers


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|x1= <sqf>[call compile getText (configfile >> "CfgVehicles" >> typeOf player >> "weaponSlots")] call BIS_fnc_invCodeToArray;//Can return [1,0,0,0,0,0,0,0]</sqf>
____________________________________________________________________________________________
 
| <!-- [] call [[BIS_fnc_invCodeToArray]]; --> |= Syntax
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[BIS_fnc_invRemove]] [[BIS_fnc_invString]] [[BIS_fnc_invSlots]] [[BIS_fnc_invSlotsEmpty]] [[BIS_fnc_invSlotType]] [[BIS_fnc_invAdd]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Inventory|{{uc:invCodeToArray}}]]
[[Category:Functions|{{uc:invCodeToArray}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:invCodeToArray}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:invCodeToArray}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:invCodeToArray}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:invCodeToArray}}]]

Latest revision as of 18:27, 8 November 2023

Hover & click on the images for description

Description

Description:
Converts inventory code (used in configs) to array with numbers for weapons and magazines (and their counts).
Execution:
call
Groups:
Inventory

Syntax

Syntax:
[configCode] call BIS_fnc_invCodeToArray
Parameters:
configCode: Number - config code, see example
Return Value:
Array of Numbers - items slots numbers

Examples

Example 1:
[call compile getText (configfile >> "CfgVehicles" >> typeOf player >> "weaponSlots")] call BIS_fnc_invCodeToArray;//Can return [1,0,0,0,0,0,0,0]

Additional Information

See also:
BIS_fnc_invRemove BIS_fnc_invString BIS_fnc_invSlots BIS_fnc_invSlotsEmpty BIS_fnc_invSlotType BIS_fnc_invAdd

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