// Do things when poses are selected

key oldst=NULL_KEY;
string an="";
facial(string s){ // expression: works with single avatar multisit
   an=s;
   if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) {
      llStartAnimation(an);
      llSetTimerEvent(2); // Loops animation
   }
}
stopfacial(){
   llSetTimerEvent(0);
   if(an!="") {
      if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(an);
      an="";
   }
}

default{
   link_message(integer sender_num, integer num, string str, key id){
      list l=llCSV2List(str);
      string ms=llList2String(l,0);
      if (ms == "start" || ms == "startf") {

         // CHANGE BELOW (put the right animation and sound names)

         if (num== 3) { // 3rd pose on notecard
            llPlaySound("sound 2",1.0);
         }

         // Add else ifs for other (different) cases:

         else if (llList2String(l,1)== "Bored Anim") { // Animation name (not menu button label)
            llLoopSound("sound",1.0);
            facial("express_bored"); // http://www.lslwiki.net/lslwiki/wakka.php?wakka=animation
         }

         else if (num== 4) { // 4th pose on notecard
            // add else ifs like this
         }

         else if (num== 5 || num== 6 ) { // 5th OR 6th pose on notecard
            // add else ifs like this
         }

      }
      else if (ms == "stop" || ms == "stopf") {
         llStopSound(); // stops sound each time an animation is stopped
         stopfacial(); // for expression animations with "single avatar multisit"
      }
   }
   // Use the part below only if you need expression animations with "single avatar multisit"
   changed(integer change) {
      if(change & CHANGED_LINK) {
         key k=llAvatarOnSitTarget();
         if(k != oldst){
            if(k != NULL_KEY) { // sit
               llRequestPermissions(k,PERMISSION_TRIGGER_ANIMATION );
            }
            else {
               stopfacial();
            }
            oldst=k;
         }
      }
   }
   timer(){
      llStartAnimation(an);
   }
   // Use the part above only if you need expression animations with "single avatar multisit"
}