Jump to content
Sign in to follow this  
gc8

generic error in expression

Recommended Posts

Hi can any one say why is this code causing generic expression error?

the error is in last line and if i comment those out the error moves futher up.

im calling this code like this: _plane call stopPlane;

stopPlane = {

_plane = _this;
_pilot = driver _plane;

hint format["hitting the brakes! %1 %2", speed _plane,_plane];

_stopMul = 0.95;

_plane setfuel 0;

while { speed _plane > 5 && alive _plane && alive _pilot && _pilot in _plane } do 
{ 


_xd = velocity _plane select 0;
_yd = velocity _plane select 1;
_zd = velocity _plane select 2;

_plane setVelocity [_xd * _stopMul, _yd * _stopMul, _zd];

sleep 2.5;
};

hint format ["done stopping %1 %2", speed _plane,_plane];

sleep 5;

_plane setfuel 1;

}


thx

Share this post


Link to post
Share on other sites

Ninja'd

At a glance.... you seem to be missing a ";" at the very end of the file. At that last bracket.

....blah...blah...blah

hint format ["done stopping %1 %2", speed _plane,_plane];

sleep 5;

_plane setfuel 1;

}[b][color="Red"];[/color][/b]

Share this post


Link to post
Share on other sites

adding ; makes no difference..

---------- Post added at 09:56 PM ---------- Previous post was at 09:41 PM ----------

turns out it was the sleep command, i had to remove them all. so i made it and sqf file and used execvm .

so no sleep command in call or what?

Share this post


Link to post
Share on other sites

Depends on where you call it from. Init lines or triggers are a no-go.

However, if it is is something that takes time and does not return a result you usually use spawn instead

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

Try something like:

_plane spawn {_this call stopPlane};

That might (not 100% sure) allow sleep within the call, but unless I need call compile, I tend to avoid using calls for anything that isn't supposed to be fast and/or uses delays.

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  

×