Reading/setting a variable via a string

rosska85

Valued Member!
Ok, so I'm working on something that uses a lot of hint displays. The problem is that a lot of people use custom debug monitors these days so I want to be able to hide the custom monitor when showing my hints and restore it after my hints.

That part is very easy to do and I've got it working, the issue is that I want it to be easy for people to change the variable for their specific debug monitor, since not everybody uses the same one and they'd have to go through and change all references to it in my scripts.

So far, I've been able to read the value of the string like so
Code:
_customDebug = "yourDebugVariable";
cDebug = call compile format ["%1",_customDebug];
Now cDebug always returns the value that 'yourDebugVariable' is set to. This means that if I use
Code:
if (cDebug) then {
It will return true if the 'yourDebugVariable' is set to true, likewise it returns false if it's set to false.

What I'm failing with is finding a way to set the value of 'yourDebugVariable' without referencing it directly. Does anybody know of a way to do this?
 
Thanks to Killzone_Kid I got an answer to this problem. I can use
Code:
missionNameSpace setVariable [format["%1",customDebug], true];
to set the variable that string is a place holder for.
 
Back
Top