Jump to content
Sign in to follow this  
unloco

Syntax Error when using "while"

Recommended Posts

Hello

I'm writing my first script and got a confusing syntax error which is breaking my "while" ..

I'm using -showScriptErrors parameter and the error is

'|#|};'
Error Missing (

Here's my code so far

in the main script:

uav addEventHandler ["fired",{_this exec "fired.sqf"}];

and then in "fired.sqf"

_uav = _this select 0;
_missile = _this select 6;

while{ alive _missile } do {
_tPos = screenToWorld [0.5,0.5];
_pPos = getPosATL _missile;
_vector_dir = [_tPos,_pPos] call BIS_fnc_vectorDiff;
_vDir = _vector_dir call BIS_fnc_unitVector;
_vUp = vectorUp _missile;
_missile setVectorDirAndUp [_vector_dir,_vUp];
_missile setVelocity _vector_dir;
};

I'm pretty sur i'm using the right syntax for "while" but the error is always there !!

I must be missing something right ?

Any help is appreciated :-)

Thank you

---------- Post added at 08:13 ---------- Previous post was at 06:48 ----------

What i was missing is that "exec" evaluates the script as sqs syntax which isn't the case, .. hence the error.

I used execVM and it worked fine.

Edited by unloco

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  

×