target_practice 163 Posted December 7, 2018 Is it possible to alter the name of a variable using a different variable? For instance, if I had a script that returned some data to a variable, what would I need to do so said variable's name could be suffixed by a string passed to the script? Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted December 7, 2018 20 minutes ago, target_practice said: Is it possible to alter the name of a variable using a different variable? For instance, if I had a script that returned some data to a variable, what would I need to do so said variable's name could be suffixed by a string passed to the script? You can't rename variables, only create new variables with a name depending on the input data, which doesn't make sense in any case I can think of. Wouldn't it be better to use a variable holding a string and adjust the string depending on input data? What are you trying to do? Cheers Share this post Link to post Share on other sites
target_practice 163 Posted December 7, 2018 I'd ideally want a script to declare a variable as true under a certain conidtion, with part of variable's name being determined by one of the arguments. Share this post Link to post Share on other sites
Dedmen 2728 Posted December 7, 2018 1 minute ago, target_practice said: I'd ideally want a script to declare a variable as true under a certain conidtion, with part of variable's name being determined by one of the arguments. You can use the setVariable command to set a variable by a name. myFunc = { params ["_varSuffix"]; missionNamespace setVariable ["condition"+_varSuffix, true]; }; "_test" call myFunc; //Variable condition_test will be set to true. 1 Share this post Link to post Share on other sites