OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Terox on 01 Mar 2007, 17:43:29
-
[group this, array] execVM "myscript.sqf"
can't get a waypoint to accept this code in it's activation field
however it will happily accept
[group this, array] exec "myscript.sqs"
is this a feature/bug or am i doing something wrong with the execVM
-
sqf is still considered to be a function by the game instead of regular script (or something like that), so you need to use either:
foo=[group this, array] execVM "myscript.sqf"or
call {[group this, array] execVM "myscript.sqf"}
Personally I prefer the latter..
-
thx H, that did it
-
It's a feature of the intended kind - in other words, that's how it's supposed to work.
The reason why the execVM (http://community.bistudio.com/wiki/execVM) attempt fails and exec (http://community.bistudio.com/wiki/exec) works is that the former is a command that returns a value (a script handle (http://community.bistudio.com/wiki/Script_%28Handle%29)) whereas exec returns nothing (http://community.bistudio.com/wiki/Nothing).
h- showed two ways of handling it - you either make use of the return value from execVM or you do a call "trick" to throw it away.
-
I stand educated :)
Is there some other use for the script handle than the use with the command terminate (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=t#terminate)?
-
Yep, you may check if one script is finished using its handler for scriptDone command.
_script1=[group this, array] execVM "myscript.sqf";
waitUntil {scriptDone _script1;};
hint "MyScript.sqf finished";
-
Right, knew about that command but completely forgot it..
Way too many new commands to make sense out of.. :P