profileNamespace: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<tt>([a-zA-Z0-9\. _"']+)<\/tt>" to "{{hl|$1}}")
m (Some wiki formatting)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


|game1= TKOH
|game1= tkoh
|version1= 1.00
|version1= 1.00


Line 12: Line 12:
|gr1= Variables
|gr1= Variables


|descr= Returns the global namespace attached to the active user profile. Use [[setVariable]] and [[getVariable]] to save and load data to and from this [[Namespace]]. A variable can be deleted by setting its value to [[nil]]. By default the variables set in this namespace will exist while the game is running and variables are saved persistently when the game is closed. Saving can also be forced by using [[saveProfileNamespace]].
|descr= Returns the global namespace attached to the active user profile. Use [[setVariable]] and [[getVariable]] to save and load data to and from this [[Namespace]]. A variable can be deleted by setting its value to [[nil]]. By default the variables set in this namespace will exist while the game is running, and variables are saved persistently when the game is closed. Saving can also be forced by using [[saveProfileNamespace]] to prevent data loss on e.g game crash.<br>
The variables are stored next to the user profile in a file named {{hl|myUsername.vars.GAMENAME}}.
The variables are stored next to the user profile in a file named {{hl|myUsername.vars.GAMENAME}}.


|s1= '''profileNamespace'''
|s1= [[profileNamespace]]


|r1= [[Namespace]]
|r1= [[Namespace]]


|x1= <code>_namespace = '''profileNamespace''';</code>
|x1= <code>[[profileNamespace]] [[setVariable]] ["TAG_kills", 10000];
 
{{cc|somewhere else in the code}}
|x2= <code>'''profileNamespace''' [[setVariable]] ["var_kills",10000];
_kills = [[profileNamespace]] [[getVariable]] ["TAG_kills", 0];</code>
_playerKills = '''profileNamespace''' [[getVariable]] "var_kills";</code>


|seealso= [[saveProfileNamespace]], [[missionNamespace]], [[uiNamespace]], [[parsingNamespace]], [[currentNamespace]], [[localNamespace]], [[allVariables]], [[with]], [[ArmA:_Editing#Forward_Compatibility|Forward Compatibility]]
|seealso= [[saveProfileNamespace]], [[missionNamespace]], [[uiNamespace]], [[parsingNamespace]], [[currentNamespace]], [[localNamespace]], [[allVariables]], [[with]], [[ArmA:_Editing#Forward_Compatibility|Forward Compatibility]]
}}
}}


<dl class="command_description">
{{Note
<dt class="note">Unknown</dt>
|user= Joris
<dd class="note">The variables are loaded when the user profile is loaded or changed.
|timestamp= 20111125173300
</dl>
|text= The variables are loaded when the user profile is loaded or changed.
}}

Revision as of 01:59, 5 December 2021

Hover & click on the images for description

Description

Description:
Returns the global namespace attached to the active user profile. Use setVariable and getVariable to save and load data to and from this Namespace. A variable can be deleted by setting its value to nil. By default the variables set in this namespace will exist while the game is running, and variables are saved persistently when the game is closed. Saving can also be forced by using saveProfileNamespace to prevent data loss on e.g game crash.
The variables are stored next to the user profile in a file named myUsername.vars.GAMENAME.
Groups:
Variables

Syntax

Syntax:
profileNamespace
Return Value:
Namespace

Examples

Example 1:
profileNamespace setVariable ["TAG_kills", 10000]; // somewhere else in the code _kills = profileNamespace getVariable ["TAG_kills", 0];

Additional Information

See also:
saveProfileNamespacemissionNamespaceuiNamespaceparsingNamespacecurrentNamespacelocalNamespaceallVariableswithForward Compatibility

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
Joris - c
Posted on Nov 25, 2011 - 17:33 (UTC)
The variables are loaded when the user profile is loaded or changed.