profileNamespace: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Category:Scripting Commands {{Command|" to "{{Command|")
m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>")
 
(39 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| TKOH |Game name=
|game1= tkoh
|version1= 1.00


|1.00|Game version=
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.62


| 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. In order to make variables save permanently, use [[saveProfileNamespace]] before the game is over.
|game3= arma3
The variables are stored next to the user profile in a file named ''myUsername.vars.GAMENAME'' (e.g. in the ''My Documents\Take On Helicopters'' folder). |DESCRIPTION=
|version3= 0.50
____________________________________________________________________________________________


| '''profileNamespace'''|SYNTAX=
|gr1= Namespaces
|gr2= Variables


| [[Namespace]] |RETURNVALUE=
|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}}.


|x1= <code>_namespace = '''profileNamespace''';</code> |Example1=
|s1= [[profileNamespace]]
|x2= <code>'''profileNamespace''' [[setVariable]] ["var_kills",10000];
_playerKills = '''profileNamespace''' [[getVariable]] "var_kills";</code> |=


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


|x1= <sqf>profileNamespace setVariable ["TAG_kills", 10000];
// somewhere else in the code
_kills = profileNamespace getVariable ["TAG_kills", 0];</sqf>
|seealso= [[saveProfileNamespace]] [[missionNamespace]] [[uiNamespace]] [[parsingNamespace]] [[currentNamespace]] [[localNamespace]] [[allVariables]] [[with]] [[ArmA:_Editing#Forward_Compatibility|Forward Compatibility]]
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= Joris
<!-- Note Section BEGIN -->
|timestamp= 20111125173300
 
|text= The variables are loaded when the user profile is loaded or changed.
<dt class="note">Unknown
}}
<dd class="note">The variables are loaded when the user profile is loaded or changed.
 
<!-- Note Section END -->
</dl>
 
<h3 style="display:none">Bottom Section</h3>
 
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Take On Helicopters: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
 
[[Category:Arma 2: Operation Arrowhead: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]

Latest revision as of 11:24, 13 May 2022

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

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:
saveProfileNamespace missionNamespace uiNamespace parsingNamespace currentNamespace localNamespace allVariables with Forward 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.