Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menu driven poses

Anderion Webb
Registered User
Join date: 8 Mar 2006
Posts: 17
04-13-2006 11:13
Hey all,

Having some problems with a script I am writing. I have an obbject that when clicked calls a menu. When a menu option is selected it sends a linked message to another script on the object. It is the linked script I am having the problem with. My goal is to have each menu option passed to the script initiate a positioned sit, and run an animation. I just can not get it to work. I will attempt to attach the script here, and perhaps someone could point out what I am doing wrong....

integer gChannel = 0;
default
{
state_entry()
{
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "laydown";)
{
vector POSITION=<0.25,-0.75,-0.4>;
rotation ROT=<1,0,0,1>;
integer perm = llGetPermissions();
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llSitTarget(POSITION, ROT);
llStopAnimation("sit";);
llStartAnimation("lay1";);
}
llSay(gChannel, "Laying Down";);
}
if (str == "sitguy";)
{
llSay(gChannel, "SITGUY";);
}
if (str == "sitgirl";)
{
llSay(gChannel, "SITGIRL";);
}
if (str == "relax";)
{
llSay(gChannel, "RELAX";);
}
}
}

Thanks!
Anderion
Ralph Doctorow
Registered User
Join date: 16 Oct 2005
Posts: 560
04-13-2006 11:57
I don't think you can set the sit target after the AV has sat down. I has to be set before that.

What is the observed behavior?

BTW, not to be pedantic, but you lie down and you lay something down.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
04-13-2006 12:17
Also, state_entry is triggered when the script starts, so at that time, there's probably no avatar on the sit target, so your request permissions call won't request it from anyone. You need to request the permissions after the person has sat down. This is usually done by checking the change event to see if someone has sat on the object. And to do that, like Ralph said, the sit target must be set before someone sits on your object.
Anderion Webb
Registered User
Join date: 8 Mar 2006
Posts: 17
04-13-2006 15:06
Thanks for the response!! I have changed the spelling to be proper. Also I have come to realize that I will not be able to use one script to initiate all animation, but one for each. The part I am stuck on now is: is there a way to make the script initiate the sit instead of having to do a right click menu option? See ideally they will click the object and get the menu. When a menu choice is made, the proper script is called that will do the sit and animate. So I need to bypass the need to do a right click and sit.

Thanks for any help you guys can give, as it is obvious I'm very much still learning.
Anderion
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
04-13-2006 15:26
As far as I know, a script can't force someone to sit. I can think of 2 options: You can animate someone without them sitting on anything, and you can present them the menu automatically when they sit.
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
04-13-2006 22:18
instead of sittarget to set the pos and rot
use llSetPos and llSetLocalRot of the
poseball itself as a childprim
so when they sit they get the dialog
to choose an anim and it will play and
move poseball
-LW