Added variable scoping.

Variables both within global scope (defined up top) and
within state function scope are now usable and will resolve
appropriately. Error checking is included for variables that
are undefined when they are used.

The definition specification was updated slightly with a
comment indicating that the set functions cannot define
a new variable.

Also an error with (ironically) scoping in the DSM was found
and corrected which had the starting state defined before the value
it is assigned is defined. This was fixed by moving it to
the bottom of the automated content of the DSM (above the engine.)