Rothwell 10 Posted March 23, 2011 Does anyone know how to make .fsm code "sleep"? Unfortunately, the sleep command doesn't work with .FSM code for some reason, neither does "waitUntil". I thought this would work: _i=0; _timeout = time; while {(_i<=5)} do { if(time>(_timeout + 1)) then { _flag setPosATL[getPosATL _static select 0, getPosATL _static select 1, (getPosATL _static select 2) - _i]; _i=_i+.02; _timeout = time; _flag setFlagTexture "\ca\data\Flag_usa_co.paa"; }; hint"in the loop"; }; unless I'm overlooking a syntax error, it's just not working how it should, it goes into an infinite loop, but never executes what's inside the if statement. Anyone know how to get around this problem? Share this post Link to post Share on other sites
Defunkt 431 Posted March 23, 2011 Set a variable... wait_until = Time + 3.0; ...then add a branch which returns straight back when the condition... Time > wait_until ...is met. Such questions belong in the scripting sub-forums HERE. Share this post Link to post Share on other sites
Jezuro 452 Posted March 23, 2011 You can spawn a new thread in an FSM state. Share this post Link to post Share on other sites
whisper 0 Posted March 23, 2011 He actually wants the fsm to pause. spawn is async Share this post Link to post Share on other sites
Jezuro 452 Posted March 23, 2011 I think Rothwell wanted to use a while-loop with sleep inside a state? But yes, the FSM won't halt at spawn. Share this post Link to post Share on other sites
Rothwell 10 Posted March 23, 2011 Ok, well I think Defunkt has come up with the proper way of doing what I want to get done. Thanks. Share this post Link to post Share on other sites
Wass 1 Posted March 23, 2011 (edited) in block _timeout = [] spawn { sleep 10; }; in condition scriptdone _timeout By this way you can loop any code in spawn function and fsm will wait when it done Edited March 23, 2011 by Wass 1 Share this post Link to post Share on other sites