Creating an ASCII Text file for ArcGIS from existing Terrain

What I need is a MAXScript that will sample an existing terrain on a grid

that is n columns by n rows with a specified interval for each. For

example: 10 columns by 10 rows with 10m between each column and 10m

between each row.

All the script needs to do is start with a point in the upper left hand

corner of the array, project a test ray in the negative Z direction, once

that ray intersects with the terrain below write that elevation along

with the point number to a .txt file and then move the point to the next

position to the right (based on the spacing interval), renumber the

point, and repeat the same output process.

Once the point gets to the end of the column it needs to go back to the

far left and begin again on the next row, keeping the numbering

consistent. The numbering for the array would begin with "Point01" in

the upper left hand corner and go from left to right until it reaches the

bottom right of the array. In this example of a 10 x 10 array the last

point number would be "Point100" which would be the last point on the far

right of the last row.

For a small array I could create points in 3dsMax and use the 'Move to

Surface' script, then export the positions myself to a text file but the

arrays I'm dealing with for this particular project are thousands of

columns x thousands of rows. This results in millions of points in the

array. Figured if I could get someone to help me out with a script that

would move, rename, and output one point that traveled around the terrain

in an array fasion, it would be an easier approach to obtaining the

elevation data in a text format.