Not sure what is causing the problem When I try to probe the Z sometimes it will work fine other times when initiating the probe it moves in the wrong direction other times it will move to the touch plate and register a touch then instead of moving up the amount specified in the Script it moves down an inch then moves up 1.25". Can someone explain if I'm doing something wrong or what it could be?

Here is my setup:

Machine: CNC Router
Y axis and A axis are slaved and home in the negative direction
Z axis homes in the positive direction
Z plate when touched to the bit triggers the digitize led
no other switches are on the same pin as the Z probe
Running Windows 10 with the latest updates
Running Version R3.043.062 of Mach3

Here is the script I am using.....this is the 4th script I have tried. Every script I have tried responds the same way as my description above. This was the most simple one I could find to eliminate any other automation the script could be doing that might be causing the issue. Someone please help....this is extremely frustrating.

Code:
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Call SetDro (2, 0.0)
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-1. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .547) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1.25 F10" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If