It never occurred to me that they did not implement Atan in Mach3 scripts since it is a standard VB function. There is a simple work around though using what are known as the Taylor Series for trig functions so the solution for finding the angle in degrees is:
slope=Zdifference/20
?
?Angle = 180*(slope-(slope^3)/3+(slope^5)/5-(slope^7)/7+(slope^9)/9)/3.14159
?
This is good to about 7 decimal places for angles below 20° so should be good enough for your needs. Once again I have not tried implementing it in Mach3 but it should work as it is using simple multiplication and division that I know works. If the exponent ^ does not work then just use slope*slope*slope for slope^3 etc. Based on what you did previously you should recognise the 180 and the 3.142589 for converting radians to degrees.
If you want better accuracy beyond 20° you just need to add more terms to the series increasing the exponent by 2 each time and alternating + and - . There is an issue of diminishing returns as you increase the angle, You need far more terms to get reasonable accuracy up to 35° for example. When you get as far as -(slope^15)/15 you are down to an accuracy of 2 decimal places for the angle 35°, one decimal place at about 38°.