Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. list g_learned;
  2. list g_punctuation=[".","?","!","'","\"",";","(",")",","];
  3.  
  4. list g_lastSpoken;
  5.  
  6. string censorWord(string word)
  7. {
  8.     if(llListFindList(g_learned+g_punctuation, [llToLower(word)])!=-1) return word;
  9.     else
  10.     {        
  11.         integer num=llStringLength(word);
  12.         string str;
  13.         while(num--) str+="_";
  14.         return str;
  15.     }
  16. }
  17.  
  18. integer RLV_ON;
  19. integer rlv_listenID;
  20. integer g_rlvCH=624634;
  21. checkRLV()
  22. {
  23.     RLV_ON=0;
  24.     rlv_listenID=llListen(g_rlvCH, "",llGetOwner(), "");
  25.     llOwnerSay("@versionnum="+(string)g_rlvCH);
  26.     llSetTimerEvent(30.0);
  27. }
  28.  
  29. integer toggleBlock=1;
  30. default
  31. {
  32.     state_entry()
  33.     {
  34.         llListen(0, "", "", "");
  35.         checkRLV();
  36.        
  37.     }
  38.     changed(integer change)
  39.     {
  40.         if(change & CHANGED_OWNER) llResetScript();
  41.     }
  42.     on_rez(integer rz)
  43.     {
  44.         checkRLV();
  45.     }
  46.     touch_start(integer num_detected)
  47.     {
  48.         if(llDetectedKey(0)==llGetOwner())
  49.         {
  50.             if(RLV_ON)
  51.             {
  52.                 toggleBlock=!toggleBlock;
  53.                 if(toggleBlock)
  54.                 {
  55.                     llOwnerSay("@recvchat_sec=n");
  56.                     llOwnerSay("RLV restraints ON");
  57.                 }
  58.                 else
  59.                 {
  60.                     llOwnerSay("@recvchat_sec=y");
  61.                     llOwnerSay("RLV restraints OFF");
  62.                 }
  63.             }
  64.         }
  65.     }
  66.     attach(key id)
  67.     {
  68.         if(id==NULL_KEY) llOwnerSay("@recvchat_sec=y");
  69.     }
  70.     listen(integer channel, string name, key id, string message)
  71.     {
  72.         if(channel ==0)
  73.         {
  74.             if(id!=llGetOwner())
  75.             {
  76.                 g_lastSpoken=llParseString2List(llToLower(message), [" "],g_punctuation);
  77.                 integer length=llGetListLength(g_lastSpoken);
  78.                 integer lp;
  79.                 string finalText;
  80.                 for (lp=0; lp<length; lp++)
  81.                 {
  82.                     finalText+=censorWord(llList2String(g_lastSpoken,lp))+" ";
  83.                 }
  84.                 llOwnerSay(finalText);
  85.             }
  86.             else
  87.             {
  88.                 message=llToLower(message);
  89.                 if(llListFindList(g_lastSpoken, [message])!=-1)
  90.                 {
  91.                     if(llListFindList(g_learned, [message])==-1)
  92.                     {
  93.                         g_learned+=message;
  94.                         llOwnerSay("You just learned the word: "+message);
  95.                     }
  96.                 }
  97.             }
  98.         }
  99.         else if (channel == g_rlvCH)
  100.         {
  101.             RLV_ON=1;
  102.             if(llGetAttached()) llOwnerSay("@recvchat_sec=n");
  103.             else llOwnerSay("@recvchat_sec=y");
  104.             llListenRemove(rlv_listenID);
  105.         }
  106.     }
  107.     timer()
  108.     {
  109.         llListenRemove(rlv_listenID);
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement