Jump to content
  • 0

ExecVM or [] execVM ?????


ElDubya

Question

Hi all, 

 

I was browsing the threads on here today and noticed someone say that you no longer need to put the [] at the start of an execVM line, so I looked into some files that I have changed as per the relevant script authors instructions, and noticed this :  

//Custom Loadouts
[] ExecVM "custom\loadout\loadout.sqf";
	
//Auto-Refuel
execVM "service_point\service_point.sqf";

Now, which is the correct way to put these? Could this be causing some small errors I am seeing in my server?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
execvm...
ExecVM...
[]ExecVM...
[]execvm...

It doesn't really matter. The empty brackets indicate that an array of values is going to be passed to the executed script. So, if you're executing a script which doesn't take any arguments it doesn't matter how you call it really. You can also pass in non array values too-

5 ExecVM....

Where 5 represents any non-array variable you wish to pass into the executed script.

But, for most scripts which don't take any arguments it's down to a choice of how you like to write your code I guess.

I tend to include the empty braces prior to executing files or functions as it lets me easily see them in my files very quickly.

Capitalisation, for the most part, doesn't particularly matter either, once again a choice of writing style.

I hope this clears it up a bit for you.

Link to comment
Share on other sites

  • 0

good way to think of it

if you see a script with

 

_option = _this select 0;
_option2 = _this select 1; 

at the start.
you can send the values to it using the braces.

["randomvariable",5] execVM "randomscript.sqf";


so _option will be the string "randomvariable"
and _option2 will be the integer 5

 

it's similar for functions aswell...
["randomvariable",5] call savedFunction;
 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...