I have a script which I was trying to figure out for the last few hours (read 4ish) and now that I've got a migraine and ended up using a script from a scripting tutorial place that now kind of works, but not quite. So can someone please help me out here?
The idea is a chair with 4 sit animations in it. The person clicks the chair and a menu pops up giving them the choice of what sit animation they wish to use to sit down. The menu pops up, the people do a sit animation but NOT in the chair but on the ground right where they are, and worse they're stuck in that sit animation with no stand up button! /SIGH
I need the stand up button to show and for them to actually sit on the chair cushion.
CODE
integer MENU_CHANNEL = 333; // set a dialog channel
list MENU_MAIN = [ "Sit 1", "Sit 2", "Sit 3", "Sit 4" ];
string anim;
default
{
touch_start(integer total_number) //wait for an avatar to touch the chair
{
llSay(0, "Respond to the dialog box and then touch the chair again");
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION); //ask permission to animate the avatar that touched the poster
state new;
}
}
state new
{
state_entry()
{
llListen(MENU_CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users
}
touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "What animation do you want your avatar to perform?", MENU_MAIN, MENU_CHANNEL); // present dialog on click
}
listen(integer channel, string name, key id, string message)
{
if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) //if animate permission has been given
{
if (message == "Sit 1")
{
anim = "sit g M";
llStartAnimation(anim);
llResetScript();
}
if (message == "Sit 2")
{
anim = "sit g F";
llStartAnimation(anim);
llResetScript();
}
if (message == "Sit 3")
{
anim = "meditation";
llStartAnimation(anim);
llResetScript();
}
if (message == "Sit 4")
{
anim = "bond6";
llStartAnimation(anim);
llResetScript();
}
}
if (! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) //if animate permission has not been given
{
llSay(0, "Agent has not given permission");
llResetScript();
}
}
}
// End of code;
Thank you for all assistance
; //ONly start the listen when touched to prevent having an open listen