{"name":"setVehicleVarName","title":"setVehicleVarName","type":"command","url":"https://community.bistudio.com/wiki/setVehicleVarName","revid":338577,"updated":"2023-03-20T15:21:44Z","groups":["Object Manipulation"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","locality":{"argument":"global","effect":"local"},"description":"Sets string representation of an object to a custom string.\nWhen 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.\nIn scripts an extra step is needed to achieve the same effect - see Example 1.\n\n> [!NOTE]\n> This does not work with Simple Objects.","syntaxes":[{"syntax":"object setVehicleVarName name","params":[{"name":"object","type":"Object","type_expr":"Object"},{"name":"name","type":"String","type_expr":"String"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"object"},"right":{"text":"name"}}],"examples":[{"text":"```sqf\nprivate _playersCar = vehicle player;\nsystemChat str _playersCar; // displays e.g \"ce06b00# 164274: offroad_01_unarmed_f.p3d\"\n\n_playersCar setVehicleVarName \"MyOffroad\";\nsystemChat str _playersCar;    // displays \"MyOffroad\"\n\nisNil \"MyOffroad\";            // true - the MyOffroad variable is not set\nMyOffroad = _playersCar;    // now it is\npublicVariable \"MyOffroad\";    // broadcasts it over the network\n```","code":["private _playersCar = vehicle player;\nsystemChat str _playersCar; // displays e.g \"ce06b00# 164274: offroad_01_unarmed_f.p3d\"\n\n_playersCar setVehicleVarName \"MyOffroad\";\nsystemChat str _playersCar;\t// displays \"MyOffroad\"\n\nisNil \"MyOffroad\";\t\t\t// true - the MyOffroad variable is not set\nMyOffroad = _playersCar;\t// now it is\npublicVariable \"MyOffroad\";\t// broadcasts it over the network"]},{"code":["_offroad setVehicleVarName \"\"; // Reset string representation to the default value"]}],"see_also":["vehicleVarName","BIS_fnc_objectVar"]}