:Grins: variable scope.
I recently posted a comment
here about this.
It's to do with when you use an 'if....then' instead of an '?...:'
When you use ?...: and initialise a variable (such as _winkel in your case), everything works fine and your variable persists long after the statement has ended.
However when you use if...then, and initialise a variable in between the curly braces, for example
if (_seitlich<0) then { _winkel = 90 + asin(_rad))} else {_winkel = 270 + asin(-_rad)}
the variable _winkel is
destroyed as soon as the if statement is complete. In the first script, _winkel is defined outside the if. In the second it is not, simple as that.
To get around this problem, you have to predefine _winkel, like this:
_winkel = false
if (_seitlich<0) then { _winkel = 90 + asin(_rad))} else {_winkel = 270 + asin(-_rad)}
then it should work ok