and sample;
Code:
BMAP* color_bmap="color.bmp"; //colormap of the terrain
function color_scan()
{
	var format,pixel;
	COLOR pixel_color;
	while(1)
	{
		c_trace(camera.x,vector(camera.x,camera.y,camera.z-5000),SCAN_TEXTURE);
		if(HIT_TARGET)
		{
			draw_point3d(hit.x,vector(0,0,255),100,5);
			format = bmap_lock (color_bmap,0);
			pixel = pixel_for_bmap(color_bmap, hit.u1, hit.v1);
			pixel_to_vec (pixel_color, NULL, format, pixel); 
			if(pixel_color.red>100)
			{
				draw_text("RED!",100,10,vector(100,100,255));
			}
			if(pixel_color.green>100)
			{
				draw_text("GREEN!",100,10,vector(100,100,255));
			}
			if(pixel_color.blue>100)
			{
				draw_text("BLUE!",100,10,vector(100,100,255));
			}
			bmap_unlock(color_bmap);
		}
		wait(1);
	}
}