I have a hud with 36 prims. The Main collects data and distributes to the children. Works perfectly, except in NoScript areas and so I decided to try out llTakeControls. All of the scripts have this code:
state get_control
{
state_entry()
{
llSetTimerEvent(10);
if (debug == TRUE) llOwnerSay("@SE"
;perms = llGetPermissions();
if ((perms & PERMISSION_TAKE_CONTROLS) == PERMISSION_TAKE_CONTROLS)
{
llSleep(2.0);
llTakeControls(CONTROL_ML_LBUTTON, TRUE,TRUE);
controlled = TRUE;
if (debug == TRUE) llOwnerSay("ct@SE"
;}
else
{
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
}
run_time_permissions(integer perms)
{
llTakeControls(CONTROL_ML_LBUTTON, TRUE,TRUE);
controlled = TRUE;
if (debug == TRUE) llOwnerSay("ct@rtp"
;state default;
}
timer()
{
if (debug == TRUE) llOwnerSay("TMO@g_c"
;llSetTimerEvent(0);
state default;
}
}
on the state_entry of default is:
if ((take_control == TRUE) && (controlled == FALSE)) state get_control;
take_control is initialized with TRUE, controlled with FALSE as globals.
Here's what happens.
I lay the scripts into the prims. Each one EXCEPT the Root prim responds with a permission request panel. The Root prim debug reports "ct@rtp" from the debug.
The Hud works perfectly in any area. However, when I DETACH and then wear the hud
all the prims start timing out repeatedly. Precisely 5 prims (never the Root) respond with the permissions panel and stop timing out. If I DETACH and wear again it repeats with a different and random 5 prims requesting and getting permission.
I am clearly mistaken about llTakeControls and getting Permission, but how so?