This is a template script as an example how to do a shader with dynamic lights, using the terrain multitexture shader concept by you and ventilator. It mixes three textures plus a shadow map, according to the red, green, and blue channels of the first terrain skin.

http://server.conitec.net/down/mtlterrainmulti.wdl

A6.31.3 is required for running the script. At the moment the 8 dynamic lights must be set manually by a script or in the shader code. In the next update, the engine will pass the light positions and colors directly to the shaders.