Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-03-2008, 12:12 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Chat Filter

I find it the best thing since the slice of bread!

PHP Code:
//#CLIENTSIDE
function onPlayerChats()
{
  if (
player.chat == "unstick me")
  {
    return 
false;
  }
  
  
temp.filters = {
    { {
"no""nah""nay"}, {"ar""yar matey""aye laddy"}},
    { {
"hello""hi""hey""hiya"}, {"'ey matey""avast"}},
    { {
"***"}, {"scallywag""scallywag"}},
    { {
"****"}, {"arrrrrrrrg""fuk""arrg""arrrrrrrrrrrrrrrrrrrg"}},
    { {
"nig""******""ngr""nigro""negro"}, {"blackskinned folk""blacker folk""cursed people"}},
    { {
"****"}, {"scurvy""davey jones waste"}},
    { {
"****""****""dik"}, {"mast""treasure chest"}},
    { {
"douchebag"}, {"waterdog""water dog"}},
    { {
"daz"}, {"black beard""blackbeard"}},
    { {
"staf""staff"}, {"crew""maties"}},
    { {
"vulcan"}, {"deckboy""deck boy"}},
    { {
"yes""yeah""yea"}, {"yar""yaaar"}},
    { {
"people""person""guy""man"}, {"folk""mate"}},
    { {
"there"}, {"ahoy"}},
    { {
"money""cash"}, {"dubloon""dubloons"}}
  };
  
  
temp.chat player.chat.tokenize();
  
  for (
temp.itemp.chat)
  {
    for (
temp.ftemp.filters)
    {
      for (
temp.gtemp.f[0])
      {
        
temp.newChat false;
        
        if (
temp.== temp.i.lower())
        {
          
temp.newChat randomstring(temp.f[1]);
        }
          else
        if (
temp.i.lower().starts(temp.g))
        {
          
temp.newChat randomstring(temp.f[1]) @ temp.i.substring(temp.g.length());
        }
          else
        if (
temp.i.lower().ends(temp.g))
        {
          
temp.newChat temp.i.substring(0temp.g.length()) @ randomstring(temp.f[1]);
        }          
        
        if (
temp.newChat != false)
        {
          
temp.chat.replace(temp.ctemp.newChat);
        }
        
      }
    }
    
temp.c++;
  }
  
  
temp.newChat "";
  
  for (
temp.ctemp.chat)
  {
    
temp.newChat @= temp." ";
  }

  
player.chat temp.newChat;

__________________
Reply With Quote
  #2  
Old 03-04-2008, 02:41 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Been there done that.

http://forums.graalonline.com/forums...ad.php?t=73726
__________________
Reply With Quote
  #3  
Old 03-04-2008, 03:01 AM
kia345 kia345 is offline
z0rbi 4 life 🤘
kia345's Avatar
Join Date: Dec 2006
Location: delteria
Posts: 6,737
kia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond reputekia345 has a reputation beyond repute
Quote:
Originally Posted by xAndrewx View Post
cursed people
I'm so glad I accidentally clicked this thread, I lol'd way harder than I should have.
__________________
pojo
Reply With Quote
  #4  
Old 03-04-2008, 03:22 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
This is a fairly weak filter. It would probably be better to use all non-word characters as delimiters for tokens (or the like), if you want it to be stronger.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #5  
Old 03-04-2008, 12:19 PM
Darklux Darklux is offline
Petrification of a Newbie
Darklux's Avatar
Join Date: Dec 2002
Location: Dortmund, Germany
Posts: 1,375
Darklux is a jewel in the roughDarklux is a jewel in the rough
Send a message via ICQ to Darklux Send a message via AIM to Darklux Send a message via Yahoo to Darklux
I don't like swear filters. The one on gk is quite script and people swear or make racist remarks all the time => it does not work at all.
Reply With Quote
  #6  
Old 03-04-2008, 09:41 PM
Frankie Frankie is offline
xChugxLifex
Frankie's Avatar
Join Date: Feb 2008
Location: New York
Posts: 1,610
Frankie is a jewel in the roughFrankie is a jewel in the rough
Send a message via AIM to Frankie Send a message via MSN to Frankie
Pirate day on Era! lmao
__________________
*Sum41Freeeeek
*Frankie
Reply With Quote
  #7  
Old 03-04-2008, 11:07 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I like swear filters, but most people do not, so I find it best to add optional clientside filters, though a custom chat system is required.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.