Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. list buttons = ["rps_countdown ", "rps_paper  ", "rps_rock ", "rps_scissors "];
  2. string dialogInfo = "\nSelect Animation.";
  3.  
  4. key ToucherID;
  5. integer dialogChannel;
  6. integer listenHandle;
  7.  string message;
  8. default
  9. {
  10.     state_entry()
  11.     {
  12.         llSitTarget( <0.0, 0.0, 0.01>, ZERO_ROTATION ); //sets sit target to prim center
  13.        // llSetSitText(llToUpper(animation));
  14.       //  llSetClickAction(CLICK_ACTION_SIT);//mouse over objeect gives chair icon
  15.         dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
  16.     }
  17.   changed(integer change)
  18.     {
  19.         if (change & CHANGED_LINK)
  20.         {
  21.             key sitter = llAvatarOnSitTarget(); // gets sitters name
  22.             if(sitter != NULL_KEY) llRequestPermissions(sitter , PERMISSION_TRIGGER_ANIMATION);
  23.             else run_time_permissions(integer perm)
  24.     {
  25.         if ( perm & PERMISSION_TRIGGER_ANIMATION )
  26.         {
  27.            // llSetAlpha(0.0, ALL_SIDES); // hide prim
  28.             if (message == "rps_countdown")
  29.         {
  30.             // process Red here
  31.             llStartAnimation("rps_countdown");//stand
  32.             llStopAnimation("sit");//cancels sit animation
  33.         }
  34.         if (message == "rps_paper")
  35.         {
  36.             // process Red here
  37.             llStartAnimation("rps_paper");//stand
  38.             llStopAnimation("sit");//cancels sit animation
  39.         }
  40.         if (message == "rps_rock")
  41.         {
  42.             // process Red here
  43.             llStartAnimation("rps_rock");//stand
  44.             llStopAnimation("sit");//cancels sit animation
  45.         }
  46.         else if (message == "rps_scissors")
  47.         {
  48.             // process Green here
  49.             llStartAnimation("rps_scissors");//stand
  50.             llStopAnimation("sit");//cancels sit animation
  51.         }
  52.             {
  53.                 if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(message);
  54. llSay(0,"stood up");
  55.                // llSetAlpha(1.0, ALL_SIDES); // show prim
  56.             }
  57.         }
  58.     }
  59.     touch_start(integer num_detected)
  60.     {
  61.         ToucherID = llDetectedKey(0);
  62.         llListenRemove(listenHandle);
  63.         listenHandle = llListen(dialogChannel, "", ToucherID, "");
  64.         llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
  65.         llSetTimerEvent(60.0); // Here we set a time limit for responses
  66.     }
  67.  
  68.     listen(integer channel, string name, key id,  string message)
  69.     {
  70.         if (message == "-")
  71.         {
  72.             llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
  73.             return;
  74.         }
  75.         }
  76.          timer()
  77.     {
  78.     //  stop timer
  79.         llSetTimerEvent(0);
  80.  
  81.         llListenRemove(listenHandle);
  82.         llWhisper(0, "Sorry. You snooze; you lose.");
  83.     }
  84. //}
  85.  run_time_permissions(integer perm)
  86.     {
  87.         if ( perm & PERMISSION_TRIGGER_ANIMATION )
  88.         {
  89.            // llSetAlpha(0.0, ALL_SIDES); // hide prim
  90.             if (message == "rps_countdown")
  91.         {
  92.             // process Red here
  93.             llStartAnimation("rps_countdown");//stand
  94.             llStopAnimation("sit");//cancels sit animation
  95.         }
  96.         if (message == "rps_paper")
  97.         {
  98.             // process Red here
  99.             llStartAnimation("rps_paper");//stand
  100.             llStopAnimation("sit");//cancels sit animation
  101.         }
  102.         if (message == "rps_rock")
  103.         {
  104.             // process Red here
  105.             llStartAnimation("rps_rock");//stand
  106.             llStopAnimation("sit");//cancels sit animation
  107.         }
  108.         else if (message == "rps_scissors")
  109.         {
  110.             // process Green here
  111.             llStartAnimation("rps_scissors");//stand
  112.             llStopAnimation("sit");//cancels sit animation
  113.         }
  114.  
  115.         llListenRemove(listenHandle);
  116.         //  stop timer since the menu was clicked
  117.         llSetTimerEvent(0);
  118.  
  119.        
  120.        
  121.     }
  122.  }
  123.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement