Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Unable to find specified agent to request permissions

Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-29-2007 01:28
Hi all, here I go again lol. Another menu driven and I sure there is a cleaner way to do it, either way I get the anims kinds however, I also get this script error: Unable to find specified agent to request permissions. Also , not getting the discreet anims, seem too at moments (if you start5 at say 4 you get it if you change to another it seems to bleed the two.
Also, it doesn't stop. I tried llStopAnimation(gAnimName);, with a 6th (stop)button but that didnt do it :-).
so any help there will also be appreciated , here's what I am screwing up ;

string gAnimName;
key user;
integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use
menu_handler = llListen(menu_channel,"","","";);
llDialog(user,title,buttons,menu_channel);
llSetTimerEvent(5.0);
}

default {
state_entry() {
//llSay(0, "Init...";);
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);

}

on_rez(integer param) {
llResetScript();
}

run_time_permissions(integer perm) {
//llStopAnimation(gAnimName);
//gToggle = 0;
}

attach(key id) {
integer perm = llGetPermissions();

if (id != NULL_KEY)
{

if (! (perm & PERMISSION_TRIGGER_ANIMATION)) {
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
else {

if (perm & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation(gAnimName);
}
}
}

touch_start(integer total_number)

{menu(llDetectedKey(0),"Guitar Menu",["Guitar 1","Guitar 2","Guitar 3","Guitar 4","Guitar 5"]);
}
timer() //so the menu timeout and close its listener
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
}
listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners
{
llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION);
}
{
if(message == "Guitar 1";)

{
llStartAnimation("Acousticply";);
}
else if(message == "Guitar 2";)
{
llStartAnimation("guitar3Relaxed";);
}
else if(message == "Guitar 3";)
{
llStartAnimation("Guitar4";);
}
else if(message == "Guitar 4";)
{
llStartAnimation("guitarplayer";);
}
else if(message == "Guitar 5";)
{
llStartAnimation("newguitar";);
}
}
}
}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-29-2007 02:25
Ray,
PLEASE use PHP tags when posting code, makes it far easier to read.

had a quick play around, not tested in SL but I think its ok

CODE

string gAnimName;
integer menu_handler;
integer menu_channel;

list Buttons = [ "Guitar 1", "Guitar 2", "Guitar 3","Guitar 4", "Guitar 5" ];
list Anims = [ "Acousticply","guitar3Relaxed","Guitar4", "guitarplayer","newguitar" ];

integer timeOut = 5;

CancelListen()
{
llSetTimerEvent(0.0);
if(menu_handler != 0) llListenRemove(menu_handler);
menu_handler = 0;
}

menu(key user)
{
//make dialog easy, pick a channel by itself and destroy it after 5 seconds
string title = "Guitar Menu";
menu_channel = 0 - (integer)llFrand(99999.0);//yup a different channel at each use
menu_handler = llListen(menu_channel,"","","");
llDialog(user,title,Buttons,menu_channel);
llSetTimerEvent(timeOut);
}

CancelCurrentAnimation()
{
if(gAnimName != "")llStopAnimation(gAnimName);
gAnimName = "";
}

PlayAnimation(integer index)
{
string name = llList2String(Anims,index);
if(name != gAnimName)
{
CancelCurrentAnimation();
// Start the new one
gAnimName = name;
if(gAnimName != "")llStartAnimation(gAnimName);
}
}

default
{
state_entry()
{
// llSay(0, "Init...");
// Only bother on attach
//llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
gAnimName = "";
}

on_rez(integer param)
{
llResetScript();
}

run_time_permissions(integer perm)
{
// llStopAnimation(gAnimName);
// gToggle = 0;
// Start playing
PlayAnimation(0);
}

attach(key id)
{
integer perm = llGetPermissions();
if (id != NULL_KEY)
{
if (! (perm & PERMISSION_TRIGGER_ANIMATION))
{
llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
}
}
else
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
CancelCurrentAnimation();
}
}
}

touch_start(integer total_number)
{
// owner Only
key id = llDetectedKey(0);
if(llGetOwner() == id) menu(id);
}

timer()
{
// so the menu timeout and close its listener
CancelListen();
}

listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners (BAD)
{
CancelListen();
// Should already have them!
// llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION);
integer index = llListFindList(Buttons,[message]);
if(index >= 0)
{
PlayAnimation(index);
}
}
}
}
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-29-2007 12:38
Hi Newgate, first let me thank you for all the wonderful help. This last code you just fixed for me still shows "PERMISSION_TRIGGER_ANIMATION permission not set", and now no animation will play. I am sure its really close. Also, is it possible to have a button called "Stop", with llstopanimation that would stop the current animation its running and would I need to make a variable for "currentanim: to do that?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-29-2007 13:48
From: Ray Musketeer
Hi Newgate, first let me thank you for all the wonderful help. This last code you just fixed for me still shows "PERMISSION_TRIGGER_ANIMATION permission not set", and now no animation will play. I am sure its really close. Also, is it possible to have a button called "Stop", with llstopanimation that would stop the current animation its running and would I need to make a variable for "currentanim: to do that?


okies, will try to address the problems once I get in to SL.
Its currently crashing for me every time I try to login. My own fault I dropped an attachment instead of dettaching it....

I was unable to get a touch to work on the attachment and I do recall having to use a channel to initiate the menu on a previous attempt at this kind of thing. Anyone?

Adding a stop option is just a case of adding a new entry to the menu and a blank animation name, gAnimName is a global that is being used to track the current playing animation.


So based on the above heres version 2!

CODE

key user;
string gAnimName;
integer menu_handler;
integer menu_channel = 99;

string title = "Guitar Menu";
list Buttons = [ "Guitar 1", "Guitar 2", "Guitar 3","Guitar 4", "Guitar 5","stop" ];
list Anims = [ "Acousticply","guitar3Relaxed","Guitar4", "guitarplayer","newguitar","" ];

CancelCurrentAnimation()
{
if(gAnimName != "")llStopAnimation(gAnimName);
gAnimName = "";
}

PlayAnimation(integer index)
{
string name = llList2String(Anims,index);
if(name != gAnimName)
{
CancelCurrentAnimation();
// Start the new one
gAnimName = name;
if(gAnimName != "")llStartAnimation(gAnimName);
}
}

default
{
state_entry()
{
gAnimName = "";
user = NULL_KEY;
}

on_rez(integer param)
{
llResetScript();
}

run_time_permissions(integer perm)
{
PlayAnimation(0);
}

attach(key id)
{
if (id != NULL_KEY)
{
user = id;
llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION);
menu_handler = llListen(menu_channel,"",user,"");
}
else
{
CancelCurrentAnimation();
user = NULL_KEY;
llListenRemove(menu_handler);
}
}

listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners (BAD)
{
integer index = llListFindList(Buttons,[message]);
if(index >= 0)
{
PlayAnimation(index);
}
else
{
string strlower = llToLower(message);
if("menu" == strlower)
llDialog(id,title,Buttons,menu_channel);
}
}
}
}
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-29-2007 20:05
Hi Newgate,
Can appreciate the sl issues lol, I have a friend whose property seems to crash anyone walking on it and many other acts of strangeness :-0. Anyway, sorry to report we seem to be going backwards the new amended script doesnt que a menu, so now no script error, nothing.
I have been using a touch 0n/off that I got working after getting some feedback on the code if you wouldn't mind I can send it to you in game, it works great on the touch. I just wish I could get the menu for the other anims to do the same lol. Again, ty for all you have done I keep looking at the color script and gives me all kinds of idea's. :-)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-30-2007 00:42
From: Ray Musketeer
Hi Newgate,
Can appreciate the sl issues lol, I have a friend whose property seems to crash anyone walking on it and many other acts of strangeness :-0. Anyway, sorry to report we seem to be going backwards the new amended script doesnt que a menu, so now no script error, nothing.
I have been using a touch 0n/off that I got working after getting some feedback on the code if you wouldn't mind I can send it to you in game, it works great on the touch. I just wish I could get the menu for the other anims to do the same lol. Again, ty for all you have done I keep looking at the color script and gives me all kinds of idea's. :-)



Sorry should have said but the new script is chat driven, type /99menu to display the menu.

There is a distinct difference between a sit based system and an attachment. With attachments you dont seem to get a touch, although I'm sure my poofie script supported touch and thats an attachment.
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-30-2007 02:29
Feeling more irritating than a chatty Cathy here lol, no menu after typing /99menu, or /99 menu. I don't mean to depend so much on you all but I am looking at this stuff so long my eys want to bleed lol
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-30-2007 04:12
From: Ray Musketeer
Feeling more irritating than a chatty Cathy here lol, no menu after typing /99menu, or /99 menu. I don't mean to depend so much on you all but I am looking at this stuff so long my eys want to bleed lol



Well I'm afraid i cant get in to SL to see what isnt working, its not that complex a script and I'm pretty sure it should be all OK!

Check that the script is ruinning and try adding a few llOwnerSay messages, one in each event handler, to show that the code is doing what we expect.

CODE

key user;
string gAnimName;
integer menu_handler;
integer menu_channel = 99;

string title = "Guitar Menu";
list Buttons = [ "Guitar 1", "Guitar 2", "Guitar 3","Guitar 4", "Guitar 5","stop" ];
list Anims = [ "Acousticply","guitar3Relaxed","Guitar4", "guitarplayer","newguitar","" ];

CancelCurrentAnimation()
{
if(gAnimName != "")
{
llOwnerSay("Cancelling " + gAnimName);
llStopAnimation(gAnimName);
gAnimName = "";
}
}

PlayAnimation(integer index)
{
string name = llList2String(Anims,index);
if(name != gAnimName)
{
CancelCurrentAnimation();
// Start the new one
gAnimName = name;
if(gAnimName != "")
{
llOwnerSay("Starting " + gAnimName);
llStartAnimation(gAnimName);
}
}
}

default
{
state_entry()
{
llOwnerSay("Guitar Player running....");
gAnimName = "";
user = NULL_KEY;
}

on_rez(integer param)
{
llResetScript();
}

run_time_permissions(integer perm)
{
PlayAnimation(0);
}

attach(key id)
{
if (id != NULL_KEY)
{
user = id;
llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION);
menu_handler = llListen(menu_channel,"",user,"");
llOwnerSay("type /" + (string)menu_channel + "menu for menu.");
}
else
{
CancelCurrentAnimation();
user = NULL_KEY;
llListenRemove(menu_handler);
}
}

listen(integer channel,string name,key id,string message)
{
llOwnerSay("listen heard " + message + " from " + name );
if (channel == menu_channel) //in case you have others listeners (BAD)
{
integer index = llListFindList(Buttons,[message]);
if(index >= 0)
{
PlayAnimation(index);
}
else
{
string strlower = llToLower(message);
if("menu" == strlower)
llDialog(id,title,Buttons,menu_channel);
}
}
}
}
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-30-2007 04:32
hi Newgate sorry to hear you can't get in game guess your still crashing :-(. anyway, I get to"Guitar player running", then nothing. It doesn't ask for permission or anything. I see the is script re-set right after the ll ownersay "Guitar player running", tht wouldnt re-set it before it ran the rest of the code would it?

Ps. I also put this llOwnerSay :

run_time_permissions(integer perm)
{
llOwnerSay("almost there....";);
PlayAnimation(0);

it doesn't show up
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-30-2007 05:43
From: Ray Musketeer
hi Newgate sorry to hear you can't get in game guess your still crashing :-(. anyway, I get to"Guitar player running", then nothing. It doesn't ask for permission or anything. I see the is script re-set right after the ll ownersay "Guitar player running", tht wouldnt re-set it before it ran the rest of the code would it?

Ps. I also put this llOwnerSay :

run_time_permissions(integer perm)
{
llOwnerSay("almost there....";);
PlayAnimation(0);

it doesn't show up


When you say you see the script reset what do you mean? If you mean the sparklies then thats not the script resetting, its being caused by the llOwnerSay.

You are attaching the object arent you?
The script wont do anything until you attach. It wont even listen to you which is why the menu wouldnt work. Attaching is not the same as touch or sit.
Excuse me if I'm being patronising its not intentional, just trying to make sure we have covered all the possible premutations!

your orginal script used attach and I've jsut carried on with the same basic setup.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-30-2007 13:33
Well I finally got back into sl and tried my scripts. The following seems to work for me fine...

I've left the debug messages inplace, you may want to delete em!

As to why previous versions didnt work, I'm not sure unless its to do with state restores when attaching. Since we where previosuly attached then attach didnt refire?

CODE

string gAnimName;
integer menu_handler;
integer menu_channel;

list Buttons = [ "Guitar 1", "Guitar 2", "Guitar 3","Guitar 4", "Guitar 5", "Stop" ];
list Anims = [ "Acousticply","guitar3Relaxed","Guitar4", "guitarplayer","newguitar","" ];

integer timeOut = 5;

CancelListen()
{
llSetTimerEvent(0.0);
if(menu_handler != 0) llListenRemove(menu_handler);
menu_handler = 0;
}

menu(key user)
{
//make dialog easy, pick a channel by itself and destroy it after 5 seconds
string title = "Guitar Menu";
menu_channel = 0 - (integer)llFrand(99999.0);//yup a different channel at each use
menu_handler = llListen(menu_channel,"","","");
llDialog(user,title,Buttons,menu_channel);
llSetTimerEvent(timeOut);
}

CancelCurrentAnimation()
{
if(gAnimName != "")llStopAnimation(gAnimName);
if(gAnimName != "")llOwnerSay("Starting animation " + gAnimName);
gAnimName = "";
}

PlayAnimation(integer index)
{
string name = llList2String(Anims,index);
if(name != gAnimName)
{
CancelCurrentAnimation();
// Start the new one
gAnimName = name;
if(gAnimName != "")llStartAnimation(gAnimName);
llOwnerSay("Starting animation " + gAnimName);
}
}

default
{
state_entry()
{
llSay(0, "Init...");
// Only bother on attach
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
gAnimName = "";
}

on_rez(integer param)
{
llResetScript();
}

run_time_permissions(integer perm)
{
// llStopAnimation(gAnimName);
// gToggle = 0;
// Start playing
llOwnerSay("Permissions Granted.");
PlayAnimation(0);
}

attach(key id)
{
integer perm = llGetPermissions();
if (id != NULL_KEY)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
// llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
PlayAnimation(0);
}
}
else
{
// if (perm & PERMISSION_TRIGGER_ANIMATION)
// {
CancelCurrentAnimation();
// }
}
}

touch_start(integer total_number)
{
// owner Only
key id = llDetectedKey(0);
if(llGetOwner() == id) menu(id);
}

timer()
{
// so the menu timeout and close its listener
CancelListen();
}

listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners (BAD)
{
CancelListen();
// Should already have them!
// llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION);
integer index = llListFindList(Buttons,[message]);
if(index >= 0)
{
PlayAnimation(index);
}
}
}
}
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-30-2007 16:57
yeah, mission ccomplished, she works and the guitar is beautiful, even if I do say so myself :-) Newgate if you would like one its yours, just IM me or come out to Fhelzgud and pick one up. Thank-you again for you perserverence while SL kept throwing us curves lol tc.