World in Conflict Tool for ArmA2 Wiki
Register
Advertisement

Compatible with v7.0c (26/03/2011)

rEXECVM is very powerful tool, but don't be "naive" -- it can give you headache too!

Required readings :

  1. Locality in Multiplayer
  2. Multiplayer framework
  3. Double trigger method


Double trigger method is excellent method for bypassing locality and signaling that something should be executed globally, rather than locally. Often a signal is generated locally, rather than globally, so that's making communication between Dedicated server and clients sometimes really painful.

On the other hand, rEXECVM seems like a good tool, but it can create a mess as I demonstrated on this image.

REXECVM

rEXECVM and Dedi Server

One way to do it is to combine double trigger method and rEXECVM.

  1. One trigger would send a by creating a new variable and sending it over network
  2. and the other trigger will catch that with !isNil "variable_name" and isServer condition and then executing some script via rEXECVM

If you use only rEXECVM...... well look at the bottom of the image... Every client could/will activate script on every other client + himself + server... by activating some trigger locally and sending request for global execution.

Now, this method is useful, but I didn't want to create so many triggers, so I made a new script.

Idea: simply, make a trigger in editor that calls sandbox_exe.sqf with path and name of SQF that needs to be executed !!!

  • you can send signal from any client, from any trigger, and to be sure it will activate that particular script only once
  • you can determine via one script which part will be executed on server, which only on clients or which only on specific player -- all in ONLY ONE script, since execution signal is coming from the server to all clients and server itself!


Syntax in WICT :

[nil,nil,rEXECVM,"WICT\sandbox\sandbox_exe.sqf","my\path\","someScript",0, parameter 0, parameter 1, ... , parameter 101] call RE;



You will see this file mentioned sandbox_exe.sqf.

Example: [nil,nil,rEXECVM,"WICT\sandbox\sandbox_exe.sqf","my\path\","someScript",0] call RE;

this will execute SQF script someScript.sqf from my\path\ folder => my\path\someScript.sqf and execution will be unique = Dedi friendly.


rEXECVM syntax :

[nil,nil,rEXECVM,"path-to-script-that-you-call", parameter 0, parameter 1, ... , parameter 101] call RE;

this is Multiplayer framework variant of :

[parameter 0, parameter 1, ... , parameter 101] execVM "path-to-script-that-you-call";

[nil,nil,rEXECVM ... is confirmed to work on Dedi


The first time the script is called it creates a variable and LOCKS any other execution!

Plus, the advantage is that you will execute that particular script on all clients, but you can also put blocks of code that will execute only on the server. What you write in that script will determine what happens next (and where - server, all clients, one client etc).

PROOF :

I did testings with diag log and showed in arma2.RPT that it is impossible to start the same script twice -- I repeated the call for the same script from init.sqf and it showed detection of double call, but script was executed only once.

However...


Restarting ID

I also made possible to restart ID and run some script again after some period of time. You just have to change number after script's name :

Example: [nil,nil,rEXECVM,"WICT\sandbox\sandbox_exe.sqf","my\path\","someScript",10] call RE;

so someScript.sqf will be available for execution after 10 seconds.

Advertisement