setVehicleVarName: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " " to " ") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(17 intermediate revisions by the same user not shown) | |||
Line 24: | Line 24: | ||
|descr= Sets string representation of an object to a custom string.<br> | |descr= Sets string representation of an object to a custom string.<br> | ||
When a vehicle is created and named in the editor, the name becomes both the variable containing the vehicle object and the string representation of the vehicle object. | When a vehicle is created and named in the editor, the name becomes both the variable containing the vehicle object and the string representation of the vehicle object. | ||
In scripts an extra step is needed to achieve the same effect | In scripts an extra step is needed to achieve the same effect - see {{Link|#Example 1}}. | ||
{{Feature|arma3|This does not work with [[Arma 3: Simple Objects|Simple Objects]].}} | {{Feature|arma3|This does not work with [[Arma 3: Simple Objects|Simple Objects]].}} | ||
Line 36: | Line 36: | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= < | |x1= <sqf> | ||
private _playersCar = vehicle player; | |||
systemChat str _playersCar; // displays e.g "ce06b00# 164274: offroad_01_unarmed_f.p3d" | |||
_playersCar | _playersCar setVehicleVarName "MyOffroad"; | ||
systemChat str _playersCar; // displays "MyOffroad" | |||
isNil "MyOffroad"; // true - the MyOffroad variable is not set | |||
MyOffroad = _playersCar; | MyOffroad = _playersCar; // now it is | ||
publicVariable "MyOffroad"; // broadcasts it over the network | |||
</ | </sqf> | ||
|x2= < | |x2= <sqf>_offroad setVehicleVarName ""; // Reset string representation to the default value</sqf> | ||
|seealso= [[vehicleVarName]] [[BIS_fnc_objectVar]] | |seealso= [[vehicleVarName]] [[BIS_fnc_objectVar]] | ||
}} | }} |
Latest revision as of 16:21, 20 March 2023
Description
- Description:
- Sets string representation of an object to a custom string.
When a vehicle is created and named in the editor, the name becomes both the variable containing the vehicle object and the string representation of the vehicle object. In scripts an extra step is needed to achieve the same effect - see Example 1. - Groups:
- Object Manipulation
Syntax
- Syntax:
- object setVehicleVarName name
- Parameters:
- object: Object
- name: String
- Return Value:
- Nothing
Examples
- Example 1:
- private _playersCar = vehicle player; systemChat str _playersCar; // displays e.g "ce06b00# 164274: offroad_01_unarmed_f.p3d" _playersCar setVehicleVarName "MyOffroad"; systemChat str _playersCar; // displays "MyOffroad" isNil "MyOffroad"; // true - the MyOffroad variable is not set MyOffroad = _playersCar; // now it is publicVariable "MyOffroad"; // broadcasts it over the network
- Example 2:
- _offroad setVehicleVarName ""; // Reset string representation to the default value
Additional Information
- See also:
- vehicleVarName BIS_fnc_objectVar
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
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Object Manipulation
- Scripting Commands: Local Effect