I tried to understand what you are trying to archive from your code, and wrote this:
Code:
#define RANGE 150

PANEL* DsPanel = {
	pos_x = 10;
	pos_y = 10;
	bmap = "paddle.pcx";
}

PANEL* DsPanelE = {
	pos_x = 200;
	pos_y = 10;
	bmap = "quad.tga";
}

void DsTriggered()
{
	if(event_type == EVENT_TRIGGER)
	{
		my.emask &= ~ENABLE_TRIGGER;
		
		var dist = abs(vec_dist(player.x, my.x));
		
		set(DsPanelE, SHOW);
		
		if(dist < RANGE)
		{
			var pressed = 1, counter = 1;
			
			while(pressed > 0){
				
				if(key_pressed(18)){
					if(pressed == 1){
						reset(DsPanelE, SHOW);
						while(counter > 0){
							counter -= time_frame / 16;
							if(vec_dist(player.x, my.x) > RANGE){ break; }
							wait(1);
						}
						set(DsPanel, SHOW);
						pressed = 2;
					}
					if(pressed == 2){
						counter = 1;
						while(counter > 0){
							counter -= time_frame / 16;
							if(vec_dist(player.x, my.x) > RANGE){ break; }
							wait(1);
						}
						reset(DsPanel, SHOW);
						pressed = 0;
					}
				}
				
				if(vec_dist(player.x, my.x) > RANGE){ break;}
				
				wait(1);	
			}
		}
		else{
			reset(DsPanelE, SHOW);	
		}
		
		while(abs(vec_dist(player.x, my.x)) < RANGE){ wait(1); }
		my.emask |= ENABLE_TRIGGER;
	}	
}

action DsTrigger() 
{
	my.emask |= ENABLE_TRIGGER;
	my.trigger_range = RANGE;	
	my.event = DsTriggered;
}

void main(){
	fps_max = 60;
	warn_level = 6;
	level_load("");
	wait(3);
	
	vec_set(sky_color.blue, COLOR_BLACK);
	
	player = ent_create(CUBE_MDL, nullvector, NULL);	
	ent_create(CUBE_MDL, vector(200, 0, 0), DsTrigger);	
	
	while(player){
		
		player.skill1 = 10 * (key_w - key_s) * time_step;
		player.skill2 = 10 * (key_a - key_d) * time_step;
		player.skill3 = 0;
		
		c_move(player, player.skill1, nullvector, IGNORE_PASSABLE | ACTIVATE_TRIGGER | GLIDE);
		
		vec_set(camera.x, player.x);
		vec_set(camera.pan, player.pan);
		
		wait(1);
	}
}

Give it a try, maybe it's something that you are looking for?

Edit: you may wanna add distance checks, so when player is out of the trigger range, you break all loops (ADDED INTO THE CODE).

Edit2: are you trying to archive somekind of a dialog thing? what are you trying to archive, maybe there is a better way to handle it. If you could tell us, then we might help you out laugh

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung