Home   Help Search Login Register  

Author Topic: What am doing wrong?  (Read 1311 times)

0 Members and 1 Guest are viewing this topic.

Offline unknownx9

  • Members
  • *
What am doing wrong?
« 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.

Offline zonker3210

  • Members
  • *
Re: What am doing wrong?
« Reply #1 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.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: What am doing wrong?
« Reply #2 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

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.
"When 900 years YOU reach, look as good you will not!"