dmarkwick 261 Posted July 5, 2009 If I set a variable, "_thisBoolean", to "true", then execVM a script, can I access this variable? I need a non-global variable that I can access from other scripts. Share this post Link to post Share on other sites
TeRp 1 Posted July 6, 2009 No, but you can pass variables to scripts, e.g. nil = [_thisBoolean] execVM "script.sqf" _thisBoolean can be accessed by _this select 0 in the script then, however it is just a copy of the variable and nothing else. Any particular reason why you can't use a global variable instead? Share this post Link to post Share on other sites
dmarkwick 261 Posted July 6, 2009 No, but you can pass variables to scripts, e.g. nil = [_thisBoolean] execVM "script.sqf" _thisBoolean can be accessed by _this select 0 in the script then, however it is just a copy of the variable and nothing else. Any particular reason why you can't use a global variable instead? I know about the passing parameters, but I need several scripts to have access to, and affect, various non-global variables. The addon works on a per-unit basis so a global variable will just get abused :) Share this post Link to post Share on other sites
Big Dawg KS 6 Posted July 6, 2009 Variable scope is sometimes unclear in ArmA. If you post some code it will be easier to help. Share this post Link to post Share on other sites
[frl]myke 14 Posted July 6, 2009 As you say it's on a per-unit basis and global variables are useless there (i see why), what about writing those variables into the units variablespace with setVariable? Share this post Link to post Share on other sites
TeRp 1 Posted July 7, 2009 Yeah, I'd use setVariable and getVariable then, too. However in MP, those are local to the client they were set on, so you'd probably need a workaround for that. But still I think this is what you're looking for. Share this post Link to post Share on other sites
sickboy 13 Posted July 7, 2009 Yeah, I'd use setVariable and getVariable then, too.However in MP, those are local to the client they were set on, so you'd probably need a workaround for that. But still I think this is what you're looking for. They are not local if you make them global :) http://community.bistudio.com/wiki/setVariable_%28VBS2%29 (ArmA2 compatible) Share this post Link to post Share on other sites