Quoting Thehawk.
Quote:
But the problem is once the value of player close is equal to anything else it wont preform the other action.

'One-time' evaluation in room1rotate.
Evaluation loops end when player in range. (trap_trigger, room2flip2reset)



Code:
action room1rotate // this is the first rotation in the demo
{
	
	var tilt0; tilt0 = my.tilt;
	
	while(player_close ==0){wait(1);}
	// the way this should work is that it checks to see if the player is close
	// this causes the first room to go to its left 90 degrees this makes the player be able to go into the next room
	// my.tilt = my.tilt - 180 * time; // tilt is up pan is horizontal
	player.z += 5;
	player.x -= 20;
	// my.event = roomreset;
	while(me != NULL) {
		if (player_close == 1) {
			if (my.tilt < (tilt0 + 180)) {
				my.tilt += 5 * time_step;
			}
		}
		if (player_close == 2) {
			snd_play (gear_wav, 100, 0);
			if (my.tilt > tilt0) {
				my.tilt -= 5 * time_step;
			}
		}
		wait(1);
	}
}

// and these are the triggers driving the action:

action trap_trigger {
	my.enable_touch = on;
	// my.event = trap_player;
	while (me != NULL) {
		if (player == NULL) { goto(fNext);}
		if (vec_dist(player.x, my.x) <= 100) {
			player_close = 1;
		}
		fNext:
		wait(1);
	}
}

action room2flip2reset {
	my.enable_touch = on;
	while (me != NULL) {
		if (player == NULL) { goto(fNext);}
		if (vec_dist(player.x, my.x) <= 100) {
			player_close = 2;
		}
		fNext:
		//my.x += 500;
		wait(1);
	}
}