Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string  NOTECARD = "notecard";
  2. string      strNotecard;
  3. integer     intLine1;
  4. key         keyConfigQueryhandle;                  
  5. key         keyConfigUUID;
  6.  
  7.  
  8.  
  9.  
  10. default
  11. {            
  12.     state_entry()
  13.     {
  14.         if (llGetInventoryType(NOTECARD) == INVENTORY_NONE)
  15.         {
  16.             llSay(DEBUG_CHANNEL, "The notecard '"+NOTECARD+"'  is missing!");
  17.             state main;
  18.         }
  19.         else
  20.         {
  21.             keyConfigQueryhandle = llGetNotecardLine(NOTECARD, intLine1 = 0);
  22.             keyConfigUUID = llGetInventoryKey(NOTECARD);
  23.         }
  24.     }
  25.    
  26.     dataserver(key keyQueryId, string strData)
  27.     {
  28.         if (keyQueryId == keyConfigQueryhandle)
  29.         {
  30.             if (strData != EOF)
  31.             {              
  32.                 string strToken;
  33.                 strData = llStringTrim(strData, STRING_TRIM_HEAD);      // Trim Whitespace
  34.                 if (llGetSubString (strData, 0, 0) != "#")              // is it a comment?
  35.                 {
  36.                     // OK .. now we do somthing in here with our notecard
  37.                 }
  38.                 keyConfigQueryhandle = llGetNotecardLine(strNotecard, ++intLine1);
  39.             }
  40.             else
  41.             {
  42.                 // Finished reasding the notecard
  43.                 state main;
  44.             }
  45.         }          
  46.     }
  47. }
  48.  
  49.  
  50. state main
  51. {
  52.     state_entry()
  53.     {
  54.         //
  55.     }
  56.    
  57.     changed(integer intChange)        
  58.     {
  59.         if (intChange & CHANGED_INVENTORY)
  60.         {   // If the notecard has changed, then reload the notecard
  61.             if (keyConfigUUID != llGetInventoryKey(NOTECARD))
  62.             {
  63.                 state default;
  64.             }
  65.         }
  66.  
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement