Advertisement
Guest User

Untitled

a guest
May 13th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. key gOwnerKey;
  2. integer gNaniteLightsChannel;
  3.  
  4. integer isVector(string testString)
  5. {
  6.     list tempList = llParseString2List(testString, [" "], ["<", ">", ","]);
  7.     if (llGetListLength(tempList) != 7)
  8.     {
  9.         return FALSE;
  10.     }
  11.     else
  12.     {
  13.         if (((string)((vector)testString) == (string)((vector)((string)llListInsertList(tempList, ["-"], 5)))) == FALSE)
  14.         {
  15.             return TRUE;
  16.         }
  17.         else
  18.         {
  19.             return FALSE;
  20.         }
  21.     }
  22. }
  23.  
  24. setNaniteColor(vector colorVector, integer linkNumber)
  25. {
  26.     llSetLinkColor(linkNumber, colorVector, ALL_SIDES);
  27.     if (colorVector == ZERO_VECTOR)
  28.     {
  29.         llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_GLOW, ALL_SIDES, 0]);
  30.     }
  31.     else
  32.     {
  33.         llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_GLOW, ALL_SIDES, 0.05]);
  34.     }
  35. }
  36.  
  37. default
  38. {
  39.  
  40.     state_entry()
  41.     {
  42.         gOwnerKey = llGetOwner();
  43.         gNaniteLightsChannel = -1 - (integer)("0x" + llGetSubString((string)gOwnerKey, -7, -1)) + 106;
  44.         llListen(gNaniteLightsChannel, "", "", "");
  45.         llRegionSayTo(gOwnerKey, gNaniteLightsChannel, "color-q");
  46.         llSetMemoryLimit(llGetUsedMemory() + 5120);
  47.     }
  48.  
  49.     on_rez(integer sp)
  50.     {
  51.         llResetScript();
  52.     }
  53.  
  54.     listen(integer channel, string name, key id, string message)
  55.     {
  56.         if (llGetOwnerKey(id) == gOwnerKey)
  57.         {
  58.             llWhisper(0, message);
  59.             if (message == "on" || message == "bolts off" || message == "charge stop")
  60.             {
  61.                 llRegionSayTo(gOwnerKey, gNaniteLightsChannel, "color-q");
  62.             }
  63.             else if (message == "off")
  64.             {
  65.                 setNaniteColor(ZERO_VECTOR, LINK_THIS);
  66.             }
  67.             else if (message == "bolts on")
  68.             {
  69.                 setNaniteColor(<1, 0, 0>, LINK_THIS);
  70.             }
  71.             else if (message == "charge start")
  72.             {
  73.                 setNaniteColor(<0, 1, 0>, LINK_THIS);
  74.             }
  75.             else if (llGetSubString(message, 0, 5) == "color ")
  76.             {
  77.                 list c = llParseString2List(message, [" "], []);
  78.                 vector color = <(float)llList2String(c, 1), (float)llList2String(c, 2), (float)llList2String(c, 3)>;
  79.                 if (isVector((string)color))
  80.                 {
  81.                     setNaniteColor(color, LINK_THIS);
  82.                 }
  83.             }
  84.         }
  85.     }
  86.  
  87. }
  88.  
  89. // Alicia
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement