Thank you. You helped me a lot. Now I have another question about this. The entity need to come down again. I have the following code for up and down.

Code:
function up() {
	while(height <= 1531) {
		height += 1.5*time_step;
		wait(1);
	}
}

function down() {
	while(height >= 256) {
		height -= 1.5*time_step;
		wait(1);
	}
}

action molen {
	while(my) {
		my.z = height;
		if(key_w == 1) {
			if(!proc_status(up)) {
				up();
			}
		}
		if(key_s == 1) {
			if(!proc_status(down)) {
				down();
			}
		}
		wait(1);
	}
}

This is the problem. When I press the key W it goes up. But when I press the key S when the entity is on his way up, the entity will stop en not comming down. How can I fix this?

Thanks in advance.