saveVar: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - ">Posted on January ([0-9]{2})[ a-zA-Z]*, ([0-9]{4})" to ">Posted on $2-01-$1")
 
(41 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.75


|1.00|= Game version
|game2= ofpe
____________________________________________________________________________________________
|version2= 1.00


| Save variable value into the campaign space. This variable is available to all following missions in the campaign. |= Description
|game3= arma1
____________________________________________________________________________________________
|version3= 1.00


| '''saveVar''' varname |= Syntax
|game4= arma2
|version4= 1.00


|p1= varname: [[String]] |= Parameter 1
|game5= arma2oa
|version5= 1.50


| [[Nothing]] |= Return value
|game6= tkoh
____________________________________________________________________________________________
|version6= 1.00
 
|x1= <pre>saveVar "varOne"</pre> |= Example 1
____________________________________________________________________________________________


| |= See also
|game7= arma3
|version7= 0.50


|gr1= Variables
|descr= Save variable value into the campaign space.
This variable is available to all following missions in the campaign.
|s1= [[saveVar]] varname
|p1= varname: [[String]]
|r1= [[Nothing]]
|x1= <sqf>saveVar "varOne";</sqf>
|seealso= [[isNil]] [[missionNamespace]] [[saveStatus]]
}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
 
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);). --[[User:Wolfrug|Wolfrug]] 22:56, 28 January 2009 (CET)
<dt><dt>
<!-- Note Section END -->
<dd class="notedate">Posted on 2009-01-28 - 22:56 (CET)</dd>
<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>
 
</dl>
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|SAVEVAR]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|SAVEVAR]]
[[Category:Scripting Commands OFP 1.46|SAVEVAR]]
[[Category:Scripting Commands ArmA|SAVEVAR]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

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