gc8 977 Posted October 29, 2011 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
twirly 11 Posted October 29, 2011 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
gc8 977 Posted October 29, 2011 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
Muzzleflash 111 Posted October 29, 2011 (edited) 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 October 29, 2011 by Muzzleflash Share this post Link to post Share on other sites
CarlGustaffa 4 Posted October 30, 2011 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