// Bromley College
// Linden Script Exhibition
// Code for Step 34 Poster
string anim = "dance1"; // animation to play
default
{
touch_start(integer total_number) //wait for an avatar to touch the poster
{
llSay(0, "Respond to the dialog box and then touch the poster again");
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION); //ask permission to animate the avatar that touched the poster. The avatar's key is provided by the touch_start event in conjunction with the llDetectedKey(0) function.
state new;
}
}
state new
{
touch_start(integer total_number)
{
if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) //if animate permission has been given start animation
{
llSay(0, "Animation beginning");
llStartAnimation(anim);
llSay(0, "I will become even more undignified than this... (King David)");
state default;
}
if (! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) //if animate permission has not been given
{
llSay(0, "Agent has not given permission");
state default;
}
}
}
// End of code;