BIS fnc invCodeToArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
m (pf)
Line 1: Line 1:
 
{{Function|Comments=
{{Function|= Comments
____________________________________________________________________________________________
____________________________________________________________________________________________


| arma2 |= Game name
| arma2 |Game name=


|1.00|= Game version
|1.00|Game version=
____________________________________________________________________________________________
____________________________________________________________________________________________


| <pre>
|Converts inventory code (used in configs) to array with numbers for weapons and magazines (and their counts).|Description=
/*
____________________________________________________________________________________________
File: fn_invSlotsEmpty.sqf
 
Description:
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]
 
*/


| [configCode] call [[BIS_fnc_invCodeToArray]] |Syntax=


//returned array gives numbers of following:
|p1=configCode: [[Scalar]] - Config code, see example |Parameter 1=
//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


| [[Array]] of [[Number|numbers]] - Items slots numbers|Return value=


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_invCodeToArray]]; --> |= Syntax
|x1= <code>[ [[call]] [[compile]] [[getText]] ([[configfile]] >> "CfgVehicles" >> [[typeOf]] [[player]] >> "weaponSlots")] [[call]] [[BIS_fnc_invCodeToArray]];//Can return [1,0,0,0,0,0,0,0]</code>|Example 1=
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________


|x1= <code></code> |=
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| [[BIS_fnc_invRemove]], [[BIS_fnc_invString]], [[BIS_fnc_invSlots]], [[BIS_fnc_invSlotsEmpty]], [[BIS_fnc_invSlotType]], [[BIS_fnc_invAdd]] |See also=
 
}}
}}



Revision as of 01:04, 28 June 2018

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:
Uncategorised

Syntax

Syntax:
[configCode] call BIS_fnc_invCodeToArray
Parameters:
configCode: Scalar - 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_invRemoveBIS_fnc_invStringBIS_fnc_invSlotsBIS_fnc_invSlotsEmptyBIS_fnc_invSlotTypeBIS_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

Notes

Bottom Section