Jump to content
Mastership

Arma 3 Remote Exec for a .sqf file?

Recommended Posts

I have been going over all the various wiki charts explaining each and every function I have seen used for other missions. Remote Exec is the only one I seem to have problems with... I may just not understand it, or I'm attempting to do something I cannot, but I haven't learned that. To give background to what I am attempting to do, I have built a small convoy mission and programmed a data terminal to open and close with several administrator options bound to it. This is not the problem, as those functions have worked well, each and every one of them. HOWEVER, instead of having the start of the scenario run on the init.sqf file, it is the Terminal that allows the "Start Mission" prompt (addaction). This runs a short script, labelled as "startscenario.sqf". I have had problems with remote exec in the past, and its ultimately been the cause of me stopping my mission making because I cannot find a way around it. Simply put, I am trying to execute "startscenario.sqf" on all clients, so the effects are ran through with every player AND the server. My coding is sloppy compared to most mission makers, and I do enjoy the copy and paste method from the wiki so I can still understand the code when not on their page. I need this file to run for this mission to even remotely feel built. Included is my 3 or four general scripts built around the terminal, but what I really need is that "startscenario.sqf" prompt to work.

If someone can help me understand how to execute a execVM through to all players connected on the server I would be very grateful.

[Below is my OpenDataTerminal.sqf that runs all of these prompts, because I can't include the file for some reason.]

Spoiler

 

removeAllActions startTerminal;

 

[startTerminal, 1] call BIS_fnc_dataTerminalAnimate;

startTerminal addAction

[

    "Start Scenario",   // title

    {"" remoteExec ["execVM startscenario.sqf", 2, true];},

    nil,        // arguments

    1,      // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "-----------------------------------------",    // title

    {[execVM "OpenDataTerminal.sqf"];},

    nil,        // arguments

    40,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "Open Arsenal", // title

    {[execVM "arsenalaccess.sqf"];},

    nil,        // arguments

    30,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "", // title

    {[execVM "OpenDataTerminal.sqf"];},

    nil,        // arguments

    35,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "", // title

    {[execVM "OpenDataTerminal.sqf"];},

    nil,        // arguments

    45,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "Close Terminal",   // title

    {[execVM "CancelDataTerminal.sqf"];},

    nil,        // arguments

    50,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

 

Share this post


Link to post
Share on other sites
1 hour ago, Mastership said:

I have been going over all the various wiki charts explaining each and every function I have seen used for other missions. Remote Exec is the only one I seem to have problems with... I may just not understand it, or I'm attempting to do something I cannot, but I haven't learned that. To give background to what I am attempting to do, I have built a small convoy mission and programmed a data terminal to open and close with several administrator options bound to it. This is not the problem, as those functions have worked well, each and every one of them. HOWEVER, instead of having the start of the scenario run on the init.sqf file, it is the Terminal that allows the "Start Mission" prompt (addaction). This runs a short script, labelled as "startscenario.sqf". I have had problems with remote exec in the past, and its ultimately been the cause of me stopping my mission making because I cannot find a way around it. Simply put, I am trying to execute "startscenario.sqf" on all clients, so the effects are ran through with every player AND the server. My coding is sloppy compared to most mission makers, and I do enjoy the copy and paste method from the wiki so I can still understand the code when not on their page. I need this file to run for this mission to even remotely feel built. Included is my 3 or four general scripts built around the terminal, but what I really need is that "startscenario.sqf" prompt to work.

If someone can help me understand how to execute a execVM through to all players connected on the server I would be very grateful.

[Below is my OpenDataTerminal.sqf that runs all of these prompts, because I can't include the file for some reason.]

  Hide contents

 

 removeAllActions startTerminal;

 

[startTerminal, 1] call BIS_fnc_dataTerminalAnimate;

startTerminal addAction

[

    "Start Scenario",   // title

    {"" remoteExec ["execVM startscenario.sqf", 2, true];},

    nil,        // arguments

    1,      // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

     3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "-----------------------------------------",    // title

    {[execVM "OpenDataTerminal.sqf"];},

    nil,        // arguments

    40,     // priority

    true,       // showWindow

    true,       // hideOnUse

     "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

  

startTerminal addAction

[

    "Open Arsenal", // title

    {[execVM "arsenalaccess.sqf"];},

    nil,        // arguments

    30,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "", // title

    {[execVM "OpenDataTerminal.sqf"];},

    nil,        // arguments

    35,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "", // title

    {[execVM "OpenDataTerminal.sqf"];},

    nil,        // arguments

    45,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

startTerminal addAction

[

    "Close Terminal",   // title

    {[execVM "CancelDataTerminal.sqf"];},

    nil,        // arguments

    50,     // priority

    true,       // showWindow

    true,       // hideOnUse

    "",         // shortcut

    "true",     // condition

    3,          // radius

    false,      // unconscious

    "",         // selection

    ""          // memoryPoint

];

 

 

 

The string for the remoted execvm is not correct.  startscenario.sqf is an arguments for the remoteexec (see "params" in first syntax in https://community.bistudio.com/wiki/remoteExec

Anyway the command execVM is not remote executable (you can find what commands are remote executable by looking at what is listed in the config under CfgRemoteExecCommands).

You can just replace it with the function BIS_fnc_execVM.

In the first addAction "Start Scenario" you should use this

 

{["startscenario.sqf"] remoteExec ["BIS_fnc_execVM", 0];}

 

This allows execution of the startscenario.sqf for all clients.

  • Like 1

Share this post


Link to post
Share on other sites

"" remoteExec ["execVM startscenario.sqf", 2, true];  // wrong for multiple reasons

 

"startScenario.sqf" remoteExec ["execVM",2];  // should work .

 

NOTE1: I don't know what your sqf is made of, but usually, you can script in an addAction code without remote executing whole sqf. That depends on arguments and effects of each used command (in sqf)!

NOTE2:    2 is for server, here. If remote execution stays "mandatory", then, instead of remoteExec this kind of code, you could have the code waiting on server for a simple condition on a variable: something like missionNameSpace setVariable ["triggerVariable",TRUE,TRUE]; so, from addAction code,  then a simple: waitUntil {missionNameSpace getVariable ["triggerVariable",FALSE]};  in your sqf, and the code continues with intended result.

It's an example. You can use publicVariable as well.

NOTE3: you can read my note in BIKI:  remote execution on server is made with 2 for execution on server only, BUT it's incompatible with TRUE for JIP.

 

Furthermore, {[execVM "CancelDataTerminal.sqf"];} has no sense. All other similar ones also. These codes are simple arrays.

I can help further, depending on what you wrote in sqf.

 

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×