Inkompetent – User talk
Inkompetent (talk | contribs) |
Inkompetent (talk | contribs) |
||
Line 8: | Line 8: | ||
NOTE EXCEPTION: [[Code]] can be used for lazy evaluation since build 93640. | NOTE EXCEPTION: [[Code]] can be used for lazy evaluation since build 93640. | ||
Example: | Example: | ||
if ((nr >= 0) and {alive(someArray select nr)}) then {}: | |||
'''Substitute while-loop with waitUntil''' | |||
Since while-loops only run for 10000 iterations one can instead use waitUntil with a false return value to emulate a while-loop that needs to run for the entire mission. | |||
Example: | |||
waitUntil { | |||
.....your code here.... | |||
sleep 0.5; | |||
false | |||
}; | |||
Revision as of 18:52, 8 July 2012
Gathered know-how
Proper use of IF-function:
Only ever use one single check per IF-function, because SQF doesn't do lazy evaluations. ALL of the checks in an IF-clause will be tested, even if the first one and all before the current tested one has failed.
NOTE EXCEPTION: Code can be used for lazy evaluation since build 93640.
Example:
if ((nr >= 0) and {alive(someArray select nr)}) then {}:
Substitute while-loop with waitUntil
Since while-loops only run for 10000 iterations one can instead use waitUntil with a false return value to emulate a while-loop that needs to run for the entire mission.
Example:
waitUntil { .....your code here.... sleep 0.5; false };
Multiplayer Scripting
http://community.bistudio.com/wiki/6thSense.eu:EG
Code Optimization
http://community.bistudio.com/wiki/Code_Optimisation
CONFIGS
http://community.bistudio.com/wiki/6thSense.eu:CG
Programming standards and suggestions
http://forums.bistudio.com/showthread.php?115836-Some-advises