Advertisement
ZornTaov

Talking Teddy

Dec 23rd, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string CONFIG_CARD = ":!:Kawaii Inc.:!: Talking Teddy";
  2.  
  3. list Sayings;
  4.  
  5.  
  6. integer NotecardLine;
  7. key QueryID;
  8.  
  9. default
  10. {
  11.     state_entry()
  12.     {
  13.         llOwnerSay("Initializing...");
  14.  
  15.         if (llGetInventoryType(CONFIG_CARD) == INVENTORY_NOTECARD)
  16.         {
  17.             NotecardLine = 0;
  18.             QueryID = llGetNotecardLine( CONFIG_CARD, NotecardLine );
  19.         }
  20.         else
  21.         {
  22.             llOwnerSay("Configuration notecard missing. :'C");
  23.         }
  24.     }
  25.  
  26.     dataserver( key queryid, string data )
  27.     {
  28.         integer index;
  29.         string name;
  30.         string value;
  31.  
  32.         if ( queryid == QueryID )
  33.         {
  34.             if ( data != EOF )
  35.             {
  36.                 if ( llGetSubString(data, 0, 0) != "#" && llStringTrim(data, STRING_TRIM) != "" )
  37.                 {
  38.                     index = llSubStringIndex(data,"%n");
  39.                     if(index != -1)
  40.                     {
  41.                         data = llDeleteSubString(data, index, 1);
  42.                         data = llInsertString(data, index, llKey2Name(llGetOwner()));
  43.                     }
  44.                 Sayings += [data];
  45.                 }
  46.                 NotecardLine++;
  47.                 QueryID = llGetNotecardLine( CONFIG_CARD, NotecardLine );
  48.             }
  49.             else
  50.             {
  51.                 state Running;
  52.             }
  53.         }
  54.     }
  55.  
  56.     state_exit()
  57.     {
  58.         llOwnerSay("Initialization Complete!");
  59.     }
  60. }
  61.  
  62. state Running
  63. {
  64.     state_entry()
  65.     {
  66.         llSetTimerEvent(1);
  67.     }
  68.     changed(integer change)
  69.     {
  70.         if ( change & CHANGED_INVENTORY)
  71.         {
  72.             state default;
  73.         }
  74.     }
  75.     timer()
  76.     {
  77.         float i = llFrand((float)llGetListLength(Sayings));
  78.         llSetTimerEvent(12);
  79.         llSay(0, llList2String(Sayings, (integer)i));
  80.     }
  81.    
  82. }
  83. ---------------------------------------------------
  84. #notecard named :!:Kawaii Inc.:!: Talking Teddy
  85.  
  86. # :!:Kawaii Inc.:!: Talking Teddy created by Kieko Runo in partnership with Zorn Taov
  87. # Your Teddy is customizable. To customize simply add your sayings at the bottom of this NC. If you want your teddy to speak directly to you use %n in place of your name.
  88.  
  89. Hi %n, Do you want to go outside and play today?
  90.  
  91. I love you %n!
  92.  
  93. You did great %n. Keep up the good work!
  94.  
  95. How was your day %n?
  96.  
  97. Psst %n i got a secret to tell you. You're the bestest friend i ever had. :D
  98.  
  99. %n, was that your tummy i heard? Maybe we should get some pizza. :D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement