Guest User

Untitled

a guest
Feb 19th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. key user;
  2. integer PowerState;
  3. integer DoorState;
  4. integer ConsoleChan;
  5.  
  6. init()
  7. {
  8.     DoorState = FALSE;
  9.     PowerState = FALSE;
  10.     ConsoleChan = (integer) (llFrand(5000) +20);
  11. }
  12.  
  13. default
  14. {
  15.     state_entry()
  16.     {
  17.     }
  18.  
  19.     touch_start(integer num)
  20.     {
  21.         user = llDetectedKey(0);
  22.         integer linknum = llDetectedLinkNumber(0);
  23.         string linkname = llGetLinkName(linknum);
  24.         if ( linkname == "Object" )
  25.         {
  26.             // Do Nothing
  27.         }
  28.         else if ( linkname == "DHD" )
  29.         {
  30.             // Do Nothing
  31.         }
  32.         else if ( linkname == "Power" )
  33.         {
  34.             if ( PowerState == FALSE )
  35.             {
  36.                 llMessageLinked(LINK_SET, 9090, "PowerOn", "");
  37.                 llShout(ConsoleChan, "PowerOn");
  38.                 PowerState = TRUE;
  39.             }
  40.             else if ( PowerState == TRUE )
  41.             {
  42.                 llMessageLinked(LINK_SET, 9090, "PowerOff", "");
  43.                 llShout(ConsoleChan, "PowerOff");
  44.                 PowerState = FALSE;
  45.             }
  46.         }
  47.         else if ( linkname == "DoorControl" )
  48.         {
  49.             if ( DoorState == FALSE )
  50.             {
  51.                 llMessageLinked(LINK_SET, 9090, "DoorOpen", "");
  52.                 llShout(ConsoleChan, "DoorOpen");
  53.                 DoorState = TRUE;
  54.             }
  55.             else if ( DoorState == TRUE )
  56.             {
  57.                 llMessageLinked(LINK_SET, 9090, "DoorClose", "");
  58.                 llShout(ConsoleChan, "DoorClose");
  59.                 DoorState = FALSE;
  60.             }
  61.         }
  62.     }
  63. }
Add Comment
Please, Sign In to add comment