waitUntil – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
m (code block run once per frame?)
m (Text replacement - "\[ *((ftp|http)s?:\/\/[^ ]+)([^{])=([^}])([^ ]+)" to "[$1$3{{=}}$4$5")
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
I was trying to use waitUntil in a trigger's OnActivation field but it would give Generic error. I set waitUntil in code but that didn't work either.
I was trying to use waitUntil in a trigger's OnActivation field but it would give Generic error. I set waitUntil in code but that didn't work either.


<code>dowaitthing = {player sidechat "hi"; waituntil {alive player}; player sidechat "boo"};
<code style="display: block">dowaitthing = {player sidechat "hi"; waituntil {alive player}; player sidechat "boo"};
</code>
</code>
And in the trigger I used '''call dowaitthing'''. ''sleep'' wouldn't work this way either. --[[User:Doolittle|Doolittle]] 18:40, 19 July 2007 (CEST)
And in the trigger I used '''call dowaitthing'''. ''sleep'' wouldn't work this way either. --[[User:Doolittle|Doolittle]] 18:40, 19 July 2007 (CEST)
Line 13: Line 13:




<code>dowaitthing =[] Spawn {player sidechat "hi"; waituntil {alive player}; player sidechat "boo"};
<code style="display: block">dowaitthing =[] Spawn {player sidechat "hi"; waituntil {alive player}; player sidechat "boo"};
</code>
</code>


Line 20: Line 20:


The output of the following code suggests that the code block is run once per frame. In the output I get no frame number is omitted or appears twice.
The output of the following code suggests that the code block is run once per frame. In the output I get no frame number is omitted or appears twice.
<code>/* for ARMA 2 only, output goes to the RPT file */
<code style="display: block">/* for ARMA 2 only, output goes to the RPT file */
_t = time + 1; // run test for about one second
diag_log ">>> start";
diag_log ">>> start";
_h = [] spawn { waitUntil { diag_log diag_frameNo; false } };
_h = [] spawn { waitUntil { diag_log diag_frameNo; false } };
waitUntil { _t < time };
sleep 1;
terminate _h;
terminate _h;
diag_log ">>> stop";</code>
diag_log ">>> stop";</code>
Line 30: Line 29:




==Performance==
== Performance ==
I have removed [http://community.bistudio.com/wiki?title=waitUntil&diff=33881&oldid=28655 Manny's note] regarding possible high system strain when using this command, as I wasn't able to verify his fears. I ran over 500 concurrent waitUntils (even without any sleep delays in them), and noticed hardly any performance degradation. --[[User:Kronzky|Kronzky]] 22:10, 29 April 2009 (CEST)
I have removed [http://community.bistudio.com/wiki?title{{=}}waitUntil&diff{{=}}33881&oldid=28655 Manny's note] regarding possible high system strain when using this command, as I wasn't able to verify his fears. I ran over 500 concurrent waitUntils (even without any sleep delays in them), and noticed hardly any performance degradation. --[[User:Kronzky|Kronzky]] 22:10, 29 April 2009 (CEST)

Latest revision as of 17:27, 28 April 2023

Is it just my imagination or do conditional waits actually check the condition very, very often? Someone might want to check out how often; more complex scripts can really degrade the performance -- Manny 16:34, 14 April 2007 (CEST)

waitUntil works within the confines of the particular hardware running Arma. If you try to exceed the capabilities of your hardware, then you will probably notice some sort of degradation. It can't perform the impossible. UNN 01:26, 17 April 2007 (CEST)

I was trying to use waitUntil in a trigger's OnActivation field but it would give Generic error. I set waitUntil in code but that didn't work either.

dowaitthing = {player sidechat "hi"; waituntil {alive player}; player sidechat "boo"}; And in the trigger I used call dowaitthing. sleep wouldn't work this way either. --Doolittle 18:40, 19 July 2007 (CEST)


If it's from a trigger or init field, you have to call it like this:


dowaitthing =[] Spawn {player sidechat "hi"; waituntil {alive player}; player sidechat "boo"};

Or move the code into a script file and spawn or execVM that file. Same goes for sleep to. UNN 15:09, 20 July 2007 (CEST)


The output of the following code suggests that the code block is run once per frame. In the output I get no frame number is omitted or appears twice. /* for ARMA 2 only, output goes to the RPT file */ diag_log ">>> start"; _h = [] spawn { waitUntil { diag_log diag_frameNo; false } }; sleep 1; terminate _h; diag_log ">>> stop"; --Worldeater 15:32, 18 June 2009 (CEST)


Performance

I have removed Manny's note regarding possible high system strain when using this command, as I wasn't able to verify his fears. I ran over 500 concurrent waitUntils (even without any sleep delays in them), and noticed hardly any performance degradation. --Kronzky 22:10, 29 April 2009 (CEST)