Tricks Posted September 11, 2014 Report Share Posted September 11, 2014 Just curious, is there a difference between [] ExecVM and execVM? Thanks! Link to comment Share on other sites More sharing options...
0 kat Posted September 11, 2014 Report Share Posted September 11, 2014 [] ExecVM and execVM are the same, The brackets are there to define arguments or strings passed to the file being executed. [true] ExecVM "path"; Tricks 1 Link to comment Share on other sites More sharing options...
0 Face Posted September 12, 2014 Report Share Posted September 12, 2014 Every time you use the execVM, spawn, or call commands, whatever value is immediately before the command is passed onto the execVM'ed/spawned/called code as the magic variable _this. Quick demonstration: //Scenario 1: [0,1,2] execVM "script.sqf"; //If _this is used inside script.sqf, it would be equal to [0,1,2]. Useful if you want to pass multiple values to a script. //Inside script.sqf: diag_log str(_this); //This would produce output of "[0,1,2]" in your RPT log. //Scenario 2: 1 execVM "script.sqf"; //If _this is used inside script.sqf, it would be equal to 1. Do this if you only want to pass a single value to a script. //Inside script.sqf: diag_log str(_this); //This would produce output of "1" in your RPT log. If you use execVM with nothing before it, the value passed would be a nil (undefined) value for _this. If you missed a semicolon on the previous line, you'll be passing the result of previous line into the execVM statement, so be careful. Personally I would always put something before every execVM/spawn/call command. If I have no value to pass on, I'd just put a 0 or [] before it. This can be especially important when using the call command, so that you can avoid passing the _this value of the calling script to the _this value of the called script. Tricks 1 Link to comment Share on other sites More sharing options...
0 Tricks Posted September 12, 2014 Author Report Share Posted September 12, 2014 Thanks guys! I really want to be able to script, but I have to learn the basics first. Link to comment Share on other sites More sharing options...
Question
Tricks
Just curious, is there a difference between [] ExecVM and execVM? Thanks!
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now