You'll need a while(true) loop to make it work.
Also: If you use getEnt() you won't need a for( ; ; ) loop, since there's only one entity.
Like this:
Code:
Function()
{
button = getEnt("button", "targetname");
door = getEnt("door", "targetname");
angle = 90; // 4 times = one full round
seconds = 1;
while(true)
{
button waittill("trigger");
door rotateYaw(angle, seconds);
door waittill("rotatedone");
wait 4;
door rotateYaw(angle*-1, seconds);
door waittill("rotatedone");
wait 10; //wait 10 seconds before next use
}
}
Some more pieces of information:
Code:
button waittill("trigger", player);
If the player is not needed in the script, so if you do not care who the player is who opened the door you can simply leave the player variable. Like this:
Code:
button waittill("trigger");
I did not test the function so please be aware of that. But it does look kinda correct to me.
Good luck with what ever you're doing