lots of stuff added.

added fsm script for experimental unit caching.
added new macros.
added more and more and more. seems to work great until now.