This is not a full working example but the Advanced Terrain commands look something like this:
(You should be able to use "SAVE OBJECT" on these terrains.)
load image "terrain-texture.png",1,0 `LOAD TERRAIN TEXTURE ('BASE PAINT MAP')
load image "detail-map.png",2 `LOAD DETAIL TEXTURE (
make object terrain 1 `MAKE TERRAIN
set terrain heightmap 1, "height-map.png" `HEIGHTMAP
set terrain scale 1,35,25,35 `SCALE TERRAIN
set terrain split 1,16 `TERRAIN SPLIT (Number of limbs for culling)
set terrain tiling 1,26 `DETAIL MAP TILING
set terrain light 1,0.6,0.6,0.6,1.0,1.0,0.9,0.9 `TERRAIN LIGHT (xdir, ydir, zdir, red, green, blue, intensity)
set terrain texture 1, 1, 2 `TEXTURE TERRAIN (1=BASE, 2=DETAIL)
build terrain 1
get terrain ground height(1,x#,z#) `GET GROUND HEIGHT
update terrain `MUST BE UPDATED INSIDE LOOP