I know you did not ask for this, but that code can be shortened.
(besides: I'm not sure if C-Script knows "else if" statements)
Here is another version, which does the same (at least it should):
Code:
var counter = 0;

var lights_red[4] = 160, 0, 255, 255;
var lights_green[4] = 32, 255, 255, 0;
var lights_blue[4] = 240, 0, 0, 0;

function change_colour()
{
	my.ambient = 500;
	my.lightrange = 150;
	
	while(1)
	{
		my.red = lights_red[counter];
		my.green = lights_green[counter];
		my.blue = lights_blue[counter];

		counter += 1;
		counter %= 4;
		wait(-1);
	}
}

action flashing_lights
{
	change_colour();
}

function main()
{
	level_load("test_light.wmb");
	wait(1);
}