User:Haama/FAR

< User:Haama
Revision as of 10:51, 26 March 2009 by imported>Haama

Functional Activators refer to scripts that behave like common programming functions. Like functions, they can:

  1. Be called from another script at any time
  2. Will happen immediately, before the next line of code is processed
  3. Can be nested (though note the limitation below)
  4. Take input parameters and can return output parameters
  5. Make your code easier to read and write
  6. Centralize sections of your code

Functional Activators require 3 parts: the script, the base activator, and the reference activator. ... empty cell, disable, persistent ... can be any object, but activators are best


General description

What they're useful for

  • Centralize code
  • Simplify code - can put complex if tests in separate FAR

Maybe go in order from least to most complex

  • onActivate only
  • Inputs/Outputs/Variables
  • Heart-beat

Limitations

  • Only 4 within each other
  • Careful with Labels/loops
  • Will take more processing due to more set/if statements, but those take 1000s to become a problem
  • Probably not a good idea to trust between save/load

Preference over other script types (should really be on Global page)

  • Compared to quest scripts
    • Run instantly
      • No need to handle timing issues and flags
      • Quest scripts may be more reliable for long-term scripts
  • Compared to result scripts
    • Longer
    • Can store variables, use ref variables in functions
    • However, result scripts can have an infinite nest depth
  • Compared to token
    • Store the information
    • Tokens better at keeping information for each actor, etc.