OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: unknownx9 on 03 Feb 2010, 02:32:29

Title: What am doing wrong?
Post by: unknownx9 on 03 Feb 2010, 02:32:29
Hello,

Just wondering if anyone would tell me what I am doing wrong here:

I am trying to addaction of starting a random pop up cycle.

this addaction ["Reset Pistol","Pistol1.sqs"]; this addaction ["Start Cycle", nul=[15,3,4]execVM "popup1.sqs"];     

the above is what I am placing in the Initialization but if I leave it as it is it will say "missing ]", and if I place that it will say "Missing;" and if I place that it will say "Reserved Variable in Expression". If anyone would be so kind as to help me fix this problem that would be much appreciated, thanks.
Title: Re: What am doing wrong?
Post by: zonker3210 on 03 Feb 2010, 21:23:17
I'm not sure that this is the problem but I think SQS scripts are called via the "exec" command....

http://community.bistudio.com/wiki/exec

The "execVM" command is used by SQF scripts. Also, note that use of "execVM" returns a handle while "exec" does not...

_handle = [p1, p2]execVM"yourScript.sqf";

...versus...

[p1, p2]exec"yourScript.sqs"

Again, there might be some other issues causing the problem but you should try fixing that first.
Title: Re: What am doing wrong?
Post by: Wolfrug on 17 Feb 2010, 23:05:04
Code: [Select]
this addaction ["Start Cycle", nul=[15,3,4]execVM "popup1.sqs"];
I really wish this was possible, but sadly it's not. AddAction has a -very- specific syntax, unfortunately nothing like the eventhandlers. Hell, I remember when there wasn't even such a command as addAction, back in pre-1.46 days of OFP :D

Here's the appropriate way of using addAction: addAction (http://www.ofpec.com/COMREF/index.php?action=details&id=5&game=All)

So basically the first one is fine, the second one needs to look the same. Doesn't matter if it's .sqs or .sqf.

Wolfrug out.