Jump to content
Sign in to follow this  
Funkman

Syntax help pls!

Recommended Posts

I just have a couple of small scripts that arent working properly:

Obj3.sqf:

if (taskState tskWestObj4) != "SUCCEEDED" then {player setCurrentTask tskWestObj4};

if (taskState tskWestObj4) = "SUCCEEDED" then {nul = execVM "EndCam.sqf"};

EndCheck.sqf:

If (taskState tskWestObj3) = "SUCCEEDED" then {nul = execVM "EndCam.sqf"};

If (taskState tskWestObj3) != "SUCCEEDED" then player setCurrentTask tskWestObj3;

If someone could set me straight with these I would appreciate it. Thanks.

Edited by Funkman

Share this post


Link to post
Share on other sites

missing paranteceses:

if ((taskState tskWestObj4) != "SUCCEEDED") then {player setCurrentTask tskWestObj4};

if ((taskState tskWestObj4) = "SUCCEEDED") then {nul = execVM "EndCam.sqf"}; 

If ((taskState tskWestObj3) = "SUCCEEDED") then {nul = execVM "EndCam.sqf"}; 

Share this post


Link to post
Share on other sites

if ((taskState tskWestObj4) != "SUCCEEDED") then {player setCurrentTask tskWestObj4};

if ((taskState tskWestObj4) = "SUCCEEDED") then {nul = execVM "EndCam.sqf"};

Try the extra brackets. The condition code should be sent like an object, so you must make sure that the brackets cover it.

Share this post


Link to post
Share on other sites

Oh thanks guys, it was telling me missing ; which was confusing the hell out of me.

Share this post


Link to post
Share on other sites

Argh, one of the scripts is still giving me this error:

"Type string, expected array" or was it "type object", something like that.

It's this first line:

If ((taskState tskWestObj3) = "SUCCEEDED") then {nul = execVM "EndCam.sqf"};

If ((taskState tskWestObj3) != "SUCCEEDED") then player setCurrentTask tskWestObj3;

---------- Post added at 02:38 PM ---------- Previous post was at 02:36 PM ----------

Should it be

If ((taskState tskWestObj3) == "SUCCEEDED") then {nul = execVM "EndCam.sqf"};

?

Share this post


Link to post
Share on other sites

I'd make the end thing a trigger on the map so it plays for everyone.

Share this post


Link to post
Share on other sites

Still the same suggestion. Why script if you don't need to? :)

Share this post


Link to post
Share on other sites

I do because I dont want the mission to end just if they have completed objective 4 (The last one), I want to also check that they have completed the other primary (Objective 3) incase they do things in a different order....

Thats why I cant use a simple trigger for it.

Anyway, they script is fairly simple, surely someone can tell me whether what I have is right or not.

Share this post


Link to post
Share on other sites

try changing:

nul = execVM "EndCam.sqf"

to this:

nul = [b][][/b] execVM "EndCam.sqf"

Share this post


Link to post
Share on other sites
Argh, one of the scripts is still giving me this error:

if (taskState tskWestObj3 == "Succeeded") then {execVM "EndCam.sqf"};

if (taskState tskWestObj3 != "Succeeded") then {player setCurrentTask tskWestObj3};

try changing:

nul = execVM "EndCam.sqf"

to this:

nul = [b][][/b] execVM "EndCam.sqf"

execVM doesn't need an argument array.

Share this post


Link to post
Share on other sites

execVM doesn't need an argument array.

Are you really sure? are there special circumstances?

when i try in a unit init line:

execVM "start1.sqf";

i get a error popping up:

type script, expected nothing

and i cannot press ok, not acepted.

Share this post


Link to post
Share on other sites
Are you really sure? are there special circumstances?

when i try in a unit init line:

execVM "start1.sqf";

i get a error popping up:

and i cannot press ok, not acepted.

You need a script handle (nul=, 0=) when execVMing in the editor.

Share this post


Link to post
Share on other sites
You need a script handle (nul=, 0=) when execVMing in the editor.

right tnx, that works, saves me from those _null = [] lines ive always used before in scripts.

Share this post


Link to post
Share on other sites
You need a script handle (nul=, 0=) when execVMing in the editor.

Correct, but isn't that a bug? The execVM information doesn't state this, it says optional. I can't think of any reason why the editor needs different syntax compared to doing it from a script.

Share this post


Link to post
Share on other sites
Correct, but isn't that a bug? The execVM information doesn't state this, it says optional. I can't think of any reason why the editor needs different syntax compared to doing it from a script.

The editor has its own retarded rules, that's for sure. execVM and spawn need handles and you can't use local variables.

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
Sign in to follow this  

×