saveVar: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:Scripting Commands OFP 1.[4-9]{2}(\|(\{\{uc:\{\{PAGENAME\}\}\}\}|#|[A-Z]+))?\]\] " to "")
m (Text replacement - ">Posted on January ([0-9]{2})[ a-zA-Z]*, ([0-9]{4})" to ">Posted on $2-01-$1")
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofp
|game1= ofp
|version1= 1.75


|1.00
|game2= ofpe
|version2= 1.00
 
|game3= arma1
|version3= 1.00
 
|game4= arma2
|version4= 1.00
 
|game5= arma2oa
|version5= 1.50
 
|game6= tkoh
|version6= 1.00
 
|game7= arma3
|version7= 0.50


|gr1= Variables
|gr1= Variables


| 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.


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


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


| [[Nothing]]
|r1= [[Nothing]]
 
 
|x1= <code>[[saveVar]] "varOne"</code>
|x1= <sqf>saveVar "varOne";</sqf>
 
|seealso= [[isNil]] [[missionNamespace]] [[saveStatus]]
}}
}}


<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->


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


<!-- Note Section END -->
</dl>
</dl>
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

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);).