saveVar: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *ofp * * *\| *([0-1]\.[0-9]{2}) * \|game2" to "|game1= ofp |version1= $1 |game2")
m (Some wiki formatting)
Line 2: Line 2:


|game1= ofp
|game1= ofp
|version1= 1.00
|version1= 1.75


|game2= ofpe
|game2= ofpe
Line 24: Line 24:
|gr1= Variables
|gr1= Variables


|descr= Save variable value into the campaign space. This variable is available to all following missions in the campaign.
|descr= Save variable value into the campaign space.
This variable is available to all following missions in the campaign.


|s1= '''saveVar''' varname
|s1= [[saveVar]] varname


|p1= varname: [[String]]
|p1= varname: [[String]]


|r1=[[Nothing]]
|r1= [[Nothing]]


|x1= <code>[[saveVar]] "varOne"</code>
|x1= <code>[[saveVar]] "varOne"</code>


|seealso=
|seealso= [[isNil]] [[missionNamespace]]
}}
}}


Line 43: Line 44:
<dt class="note">[[User:Wolfrug|Wolfrug]]</dt>
<dt class="note">[[User:Wolfrug|Wolfrug]]</dt>
<dd class="note">If you try to saveVar a vehicle saved in your variable (SavedVars = [Car1]; saveVar "SavedVars"), then Car1 will not be properly "saved", refering to ObjNull if you try to use it in subsequent missions, even if a vehicle with the same vehicle varname exists. To get around this, save the vehicle's varname as a string (SavedVars = [str(Car1)]) and then when you need it just use call compile to "unstring" the varname (_car = call compile (SavedVars select 0);).
<dd class="note">If you try to saveVar a vehicle saved in your variable (SavedVars = [Car1]; saveVar "SavedVars"), then Car1 will not be properly "saved", refering to ObjNull if you try to use it in subsequent missions, even if a vehicle with the same vehicle varname exists. To get around this, save the vehicle's varname as a string (SavedVars = [str(Car1)]) and then when you need it just use call compile to "unstring" the varname (_car = call compile (SavedVars select 0);).
</dd>


</dl>
</dl>
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

Revision as of 20:03, 14 June 2021

Hover & click on the images for description

Description

Description:
Save variable value into the campaign space. This variable is available to all following missions in the campaign.
Groups:
Variables

Syntax

Syntax:
saveVar varname
Parameters:
varname: String
Return Value:
Nothing

Examples

Example 1:
saveVar "varOne"

Additional Information

See also:
isNil missionNamespace

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
Posted on January 28, 2009 - 22:56 (CET)
Wolfrug
If you try to saveVar a vehicle saved in your variable (SavedVars = [Car1]; saveVar "SavedVars"), then Car1 will not be properly "saved", refering to ObjNull if you try to use it in subsequent missions, even if a vehicle with the same vehicle varname exists. To get around this, save the vehicle's varname as a string (SavedVars = [str(Car1)]) and then when you need it just use call compile to "unstring" the varname (_car = call compile (SavedVars select 0);).