01-12-2007 21:50
I tried this with a couple of people. The following code should all return the avatar key of the person interacting with this object. You can test it out and see that it does not. It seems to always return my key (or the owner key) when the Control Event is thrown. Am I missing something? I thought it was supposed to put the key of the person it had control from? Once you put this code in an object. Touch it, and give it control permissions. Then go into mouselook and click. After that, take a look at the script warning (I use as a debug window) and see what ID keys it returns. (you have to have someone else click on it to see if the keys change appropriately.

integer debug = 1;
integer debugChan = DEBUG_CHANNEL;
default
{
state_entry()
{
llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS | PERMISSION_TRACK_CAMERA);
if(debug > 0) llSay(debugChan, "Detected Key:" + (string)llDetectedKey(0));
}

run_time_permissions(integer perm)
{
if(perm & PERMISSION_TAKE_CONTROLS)
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);

}

control(key idRx0, integer down, integer new)
{
integer pressed = down & new;
integer held = down & ~new;
integer released = ~down & new;

if(debug > 0) llSay(debugChan, "otherObj:Control:ID: " + (string)idRx0);

if (pressed & CONTROL_ML_LBUTTON)
{
if(debug > 0) llSay(debugChan, "otherObj:ML clicked";);
}
}
}