I have read with real interest the discussions. I am afraid I complicated things by trying to "simplify" the example. This is a Function which I use for window blinds, stage curtains, garage doors and stuff like that. It raises and lowers by resizing and repositioning. With trivial changes it can work in the x or y planes.
blind_moving()
{
llLoopSound("Blind Moving",15.0);
if (isopen == FALSE)
{
isopen = TRUE;
for (counter = 0; counter < fullopen; ++counter)
{
psize.z = psize.z + startwidth; //psize local to object
pposition.z = pposition.z - (startwidth / 2); //pposition is global
llSetPrimitiveParams([PRIM_SIZE,psize,PRIM_POSITION,pposition]);
}
}
else
{
isopen = FALSE;
for (counter = 0; counter < fullopen; ++counter)
{
psize.z = psize.z - startwidth;
pposition.z = pposition.z + (startwidth / 2);
llSetPrimitiveParams([PRIM_SIZE,psize,PRIM_POSITION,pposition]);
}
}
llStopSound();
}
There is no sleep. If I am reading what Nova said correctly, once this function is called, there is no way to interupt until is is finished? Thanks all for the comments!