Difference between revisions of "Minimizing your Script"
m
Small change to eliminate confusion for new scripters.
imported>Halo112358 (added best practices section discussing early return calls vs if blocks) |
imported>XJDHDR m (Small change to eliminate confusion for new scripters.) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
The following is only important when a script does a CPU intensive task that is known or has been tested to affect the frame rate. This is generally reduced to situations that involve naive searching, sorting, or constant iteration through many references. Code that must have inefficient algorithms can best take advantage of the techniques here. Note that almost all code produced with the vanilla editor will already run well, regardless of programming technique. | |||
== Gamemode Scripts == | == Gamemode Scripts == | ||
Avoid using gamemode scripts wherever possible. Use quest scripts if you can, or try to find ways to put as much of the script work into OnLoad, OnEquip, and ScriptEffectStart blocks as possible. | Avoid using gamemode scripts wherever possible. Use quest scripts if you can, or try to find ways to put as much of the script work into OnLoad, OnEquip, and ScriptEffectStart blocks as possible. | ||
Line 27: | Line 29: | ||
begin GameMode | begin GameMode | ||
if (some condition) | if (some condition) != 0 | ||
(some | (some inefficient/complex algorithm) | ||
endif | endif | ||
end</pre> | end</pre> | ||
Line 41: | Line 43: | ||
endif | endif | ||
(some | (some inefficient/complex algorithm) | ||
end</pre> | end</pre> | ||