What? No. It does not work as designed at all. I can only assume that you don't know what the script actually should do, because what you just said makes absolutely no sense in this context. Therefore, I will explain it as plainly as possible, as to clean up any confusion.
Note: Kinda biggish.
×Set var "_MyScriptX" = (_MyO % 3) - 1
Set var "_MyScriptY" = (_MyO / 3) - 1
Note that _MyO works like this
0 1 2
3 X 5
6 7 8
where X is the creature, and the number the creature is facing is what _MyO is. So '_MyO % 3' would returns this,
0 1 2
0 2
0 1 2
and '_MyO / 3' this.
0 0 0
1 1
2 2 2
Subtract one from both of those and a creature gets (-1,-1) if facing northwest, (0,1) if facing south, etc. Note that every coordinate happens to always be directly in front of the creature. So we assign _MyScriptX to '(_MyO % 3) - 1', and _MyScriptY to '(_MyO / 3) - 1', and basically translates to 'move one square forward'.
Moving on...
If ...
Move 0,0,0,0
If you don't understand why the 'If' is there, you have no right to act like you know more about scripting then I do. So onto the 'Move' statement. For all normal DROD players, you don't understand that _MyScriptX and _MyScriptY hijack the X,Y coordinates of 'Move'. So if the character was facing east, this would become 'Move 1,0,0,0', and if he was facing north, it would become 'Move 0,-1,0,0'. This is also where the bug appears. When the character turns around, the _MyScriptX and _MyScriptY are correct when set by the 'Set' commands, but the 'Move' statement for some reason keep using the first _MyScriptX and _MyScriptY.
Set var "_MyScriptX" = -9999
Set var "_MyScriptY" = -9999
_MyScriptX and _MyScriptY affect a lot of commands, including Wait, which I also use. To reset them, you set them to -9999 (surprise). I like keeping them at -9999 every time the script gets to the 'Goto'. It's good practice, if nothing else.
Set var "_MyO" = 8 - _MyO
This basically inverts _MyO. Figure out why yourself (it's not hard).
Remember, I'm the guy that can make almost anything happen (if I don't procrastinate it out of existence) with the scripting engine one way or another. I know a scripting bug when I see it.