heya, whenever i use entities in a game, i define them with a class (__class) so i know know what they are when using them
Code:
#define __class skill1
	#define _class_candle 1

have the function that'll determine what the light does
Code:
//operate candle
function click_light(ENTITY* _ent){
	
	//toggle the ambience
	_ent.ambient = 100 - _ent.ambient; //100 - 100 = 0  ||  100 - 0 = 100
	
	//display text
	set(message_txt, SHOW);
	
	//wait 1 second
	wait(-1);
	
	//hide text
	reset(message_txt, SHOW);
}

have 1 function that catches all mouse_clicks, i've shortened here though so you can see what's happening easier
Code:
//catches all mouse_left clicks
function mouse_click(){
	
	//if hit any entity
	if(mouse_ent){
		
		//see what's being clicked
		switch(mouse_ent.__class)
			
			//if candle
			case _class_candle:
				
				//call click_light
				click_light(mouse_ent);
			break;
		}
	}
}

then set your mouse function for left clicks
Code:
void main(){
	mouse_mode = 4;
	on_mouse_left = mouse_click;
}

also if you use mouse_mode = 4; it'll save using while(1) vec_set(mouse_pos, mouse_cursor etc...

Hope this helps!
*untested*