Minimizing your Script

Revision as of 01:43, 2 October 2007 by imported>Haama (Category link)

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.

If you need to use a GameMode block, use an 'if' test or a flag so the code will only run when necessary. For instance, if you need to run an item script whenever the player hits a switch, place this on the switch:

scn YourSwitchScript

short Working

begin onActivate
  set Working to 1
end

and this on the item:

scn YourItemScript

begin GameMode
  if YourSwitchScript.Working
...
  endif
end