llTargetOmega(<0.0, 0.0, 0.0>, 0.0, 0.0);
only works when this line is written (or a pre-written script is dropped) in an unlinked or root prim. if placed in a linked child prim, it fails to stop any previous TargetOmega rotations. if the script is written/dropped in an unlinked prim, which is linked AFTERWARDS, it works fine. it also works fine in unliked or linked root prims.
test:
1: rez a box and a prism. the box will be our test spinny object, the prism our test base object. DO NOT LINK.
2: select bot prims and copy for a total of 5 sets of test prims.
3: Set 1: delete the prism to have a single, Unlinked Prim.
Set 2: select the box and prism, then link, to have the box as a Linked Child.
Set 3: select the prism and box, then link, to have the box as a Linked Child.
Set 4: leave unlinked for now.
Set 5: leave unlinked for now.
4: drop the following script in all the boxes:
==========================================
//--keep track of what 'state' we are in
integer ON = FALSE; //-- ie 'not on'
default
{
state_entry()
{
llTargetOmega(<0, 0, 0>, 0.0, 0.0);
//llSetTimerEvent(6.0);
ON = FALSE; //--to make sure we start out turned off, in case of going to inventory while spinning or somesuch
}
touch_start(integer num)
{
if(ON) //--same as 'if(ON == TRUE)' but shorter
{//--then turn off
llTargetOmega(<0.0, 0.0, 0.0>, 0.0, 0.0);
//--this should set it to no spinning, but only works if this script is put in an un-linked prim. (you can link it after putting the script in.)
}
else //--or else it's off (ie: FALSE)
{//--then turn it on
llTargetOmega(<1.0, 0, 0>, 9.0, 1.0);
}
ON = !ON; //--change ON to whatever it was NOT before. ie: flip TRUE/FALSE
llSetText("", <0,0,0>, 0);
}
}
==============================================
5: link up sets 4 and 5 thus:
Set 4: select box and prism, and link, so box is Linked Child.
Set 5: select prism and box, and link, so box is Linked Root.
6: touch each box to start them spinning. touch again to stop them from spinning.
Result:
all work, except the box that was a Linked Child when the script was dropped in. go figure!
Note:
this uses the settext workaround to force an update, in case the object is to be worn as an attachment. however, i have tested this -as an attachment- without the settext in, and it still works the same.