I copied the code and save it as terrain.c file.
However, I couldn't add it as main running script in the WED. What I did is WED/Project manager, and change the main script from terrain.wdl to terrain.c. The project manager does not recognize .c script and automatically changes it back to terrain.wdl.
So weird. Do you have any other solutions?
This terrain is really important to my current project, I really appreciate your help.