saveVar: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|x([0-9])= <sqf>([^\/: ]+)([^;])<\/sqf>" to "|x$1= <sqf>$2$3;</sqf>")
m (Text replacement - ">Posted on January ([0-9]{2})[ a-zA-Z]*, ([0-9]{4})" to ">Posted on $2-01-$1")
 
(One intermediate revision by one other user not shown)
Line 35: Line 35:
|x1= <sqf>saveVar "varOne";</sqf>
|x1= <sqf>saveVar "varOne";</sqf>


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


Line 41: Line 41:


<dt><dt>
<dt><dt>
<dd class="notedate">Posted on January 28, 2009 - 22:56 (CET)</dd>
<dd class="notedate">Posted on 2009-01-28 - 22:56 (CET)</dd>
<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);).

Latest revision as of 23:02, 13 May 2023

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 saveStatus

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 2009-01-28 - 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);).