Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

start anim by chat

Myeia Boa
Registered User
Join date: 18 Jul 2008
Posts: 9
07-23-2008 06:16
Hey guys
I have this script but it wont work would anyone take a look and tell me why?


default
{
state_entry()


{
llListen(3,"",llGetOwner(),"";);
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}

listen(integer channel, string name, key id, string message)
{
if (llToLower (message) == "on";)
{

llStartAnimation("xxxxx";);

}
if( message == "off" )
{

llStopAnimation("xxxxx";);
{


}
} }
}

Thanks!
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
07-23-2008 08:02
you need a permission event
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
07-23-2008 09:03
correct, the llRequestPermissons() function triggers a run_time_permissions() event. Look up llRequestPermissions() in the wiki http://wiki.secondlife.com


http://www.secondscripter.com
_____________________
My tutes
http://www.youtube.com/johanlaurasia
Myeia Boa
Registered User
Join date: 18 Jul 2008
Posts: 9
07-23-2008 09:08
like ?

run_time_permissions(integer permissions)
{
if (PERMISSION_TRIGGER_ANIMATION & permissions)
{


edit

sorry i did not see your post , i will look at that thanks
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
07-23-2008 09:16
Assuming she is not denying the permission pop-up, why would a run_time_permissions handler be required?
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Myeia Boa
Registered User
Join date: 18 Jul 2008
Posts: 9
07-23-2008 09:59
she? (she!)

they said i needed somthing like this run_time_permissions() event , a permssion event ?
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
07-23-2008 10:08
Yep. See http://wiki.secondlife.com/wiki/Run_time_permissions .

I don't see why it's really needed. The run_time_permissions event just tells the script which permissions were granted by the user. It should not (AFAIK) be required to make permission stuff happen, though.

Where is this script? In an attachemnt? On something you sit on? On the ground somewhere?

If you reset the script, do you see it ask you for animation permission?


edit: I'm betting you've got an AO with a higher priority animation in it. That or it's an object you sit on, in which case you may need to stop the standard sit anim first.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Urrong Urnst
Registered User
Join date: 12 Jul 2008
Posts: 49
07-23-2008 13:28
Yes i think AO is the problem too. I tested the script with exact code and it worked for me just fine.
Myeia Boa
Registered User
Join date: 18 Jul 2008
Posts: 9
07-23-2008 16:55
i have looked it again and i am sure it is the permission. so would the permission event go into the listen event like this?

default
{
state_entry()


{
llListen(3,"",llGetOwner(),"";);

}


listen(integer channel, string name, key id, string message)
{

llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{

{
if (llToLower (message) == "on";)
{ etc etc .

thanks , for all the help so far !
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-23-2008 18:34
It works just fine without that run_time_permissions() event handler. Just checking the obvious here: the test utterance was something like "/3 on" (i.e., you were talking on the same channel for which the script was listening), correct? and the "xxxxx" was actually an animation in the scripted object's contents, or else one of the built-in animations, right?

Just for completeness, if one had to use a run_time_permission() handler, it couldn't refer to the "message" variable because that's only bound within the scope of the listen. So the listen handler would have to set some global variable that would be in scope in the run_time_permissions handler.

But then the question is important, whether the scripted thing is sat-upon or attached, or just some other thing rezzed in-world. If it's attached or sat-upon, then llRequestPermissions() won't actually have to ask the user explicitly for permissions. Otherwise, it has to ask, and it would be really annoying to ask that more than once, so one would want to do llGetPermissions() to see if the script needs to request them or not. So one might end up with something like:

CODE

integer CHANNEL = 3; // Remember to say "/3 on" to start the animation.
string msg; // To know what listen() heard, later when get permissions
string anim; // To use the (first) animation in the object's contents

animStartOrStop()
{
if (msg == "on")
llStartAnimation(anim);
else
llStopAnimation(anim);
}


default
{
state_entry()
{
anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
llListen(CHANNEL,"",llGetOwner(),"");
}
listen(integer channel, string name, key id, string message)
{
msg = llToLower(message);
if ((msg == "on") || (msg == "off"))
{
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
animStartOrStop();
else
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer perms)
{
if (perms & PERMISSION_TRIGGER_ANIMATION)
animStartOrStop();
}
}


(Note: If the code doesn't appear indented, try using the reply Quote button.)

Also, this all assumes that the scripted object will never change owners, because it only listens to whomever is the owner at time of state_entry. If it will change owners by being passed into another's inventory and re-rezzed, probably also want the common "on_rez(integer parm) { llResetScript(); }"
_____________________
Archived for Your Protection
Myeia Boa
Registered User
Join date: 18 Jul 2008
Posts: 9
07-24-2008 04:04
The xxx was a animation and i was speaking on channle 3. This is an attachment. Thanks for all your help , Everyone . the script is working how i wanted . Thanks