what I am TRYING to to is to make an item, that - once worn - will play an animation and also take away the UP and DOWN arrow keys. My English probably isn't good enough to understand the documentation because I wrote the following script and it has an extremely weird behaviour I cannot understand.
Instead of saying "requesting perms" then jumping to runtime_permissions and saying "request received" and then getting on with the next request I get the following output:
[6:12] Dummy: Requesting Anim permissions
[6:12] Dummy: Requesting Control permissions
[6:12] Dummy: Anim request received
[6:12] Dummy: Control request received
[6:12] Dummy: Anim request received
[6:12] Dummy: Control request received
I cannot understand why (a) both requests happen immediately after another - I thought the WIKI said that this would trigger run_time_permissions FIRST which apparently it doesn't and also my checking which permissions were requested must be faulty because I get the answer twice.
Any help with this would be greatly appreciated! I really cannot make head or tails of the documentation.
CODE
list animations = ["x","y","z"];
list test = ["a","b","c"];
integer channel= 23; // the channel the device listens to
string curranim; // animation orders issued - needed to terminate prior animations
string animation;
default
{
state_entry() {
llListen( channel, "", llGetOwner(), "" );
curranim="";
animation = llList2String(test, 0);
}
on_rez(integer dummy) {
}
attach (key attached) {
if (attached != NULL_KEY) {
// llRequestPermissions(attached, PERMISSION_TRIGGER_ANIMATION && PERMISSION_TAKE_CONTROLS);
llOwnerSay("Requesting Anim permissions");
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
llOwnerSay("Requesting Control permissions");
llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS);
} else {
llReleaseControls();
}
}
run_time_permissions(integer perms) {
if(perms && PERMISSION_TRIGGER_ANIMATION) {
llOwnerSay("Anim request received");
llStartAnimation(animation);
}
if (perms && PERMISSION_TAKE_CONTROLS) {
llOwnerSay("Control request received");
llTakeControls(CONTROL_FWD && CONTROL_BACK,TRUE,FALSE);
} else {
llStopAnimation(animation);
llResetScript();
}
}
listen( integer channel, string name, key id, string message ) {
}
}
Seagel Neville