Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-29-2003, 09:15 PM
TribulationStaff TribulationStaff is offline
Registered User
Join Date: Jul 2003
Location: Pennsylvania
Posts: 368
TribulationStaff is on a distinguished road
Send a message via AIM to TribulationStaff
Gift Script for all servers

With all the new servers, I am sure there is at least one that did not think about making a profanity filter. To save everyone some time, here is the one I made for Tribulation. A caveat: put longer swears first unless you don't want the whole word ***ed. Example, listing just the f-bomb would change what Oedipus was into mother****er, or listing an alternative name for a donkey would change another word for part of your posterior to ***hole. So put the longer words first if you don't like this solution. Without further ado, the script:

[edit]I realized that the original script had problems with words like assassin, so I changed it to check whole words only. Sorry, it means a much longer list of obscenities. On the bright side, it means you don't need to worry about putting longer swears first. The other option is to make a list of exception words, which I will post according to public demand[/edit]

[edit2]Fixed a bug where mASSive a** (and other such phrases)was not censored. [/edit2]

NPC Code:

// NPC made by gilt
//#CLIENTSIDE
if (created) {
setstring this.filter,your,words,here;
}
if (playerchats)
{
tokenize #c;
this.offset=0;
for (this.j=0;this.j<tokenscount;this.j++)
{
for (this.i=0;this.i<sarraylen(this.filter);this.i++)
{
this.index=indexof(#I(this.filter,this.i),#e(this. offset,-1,#c));
if (this.index!=-1&&(strequals(#e(this.index-1+this.offset,1,#c), )||this.index+this.offset==0)&&(strequals(#e(this. index+this.offset+strlen(#I(this.filter,this.i)),1 ,#c), )) )
{
setstring this.remainder,#e(this.index+this.offset+strlen(#I (this.filter,this.i)),-1,#c);
for (this.k=0;this.k<strlen(#I(this.filter,this.i));th is.k++)
{
setplayerprop #c,#e(0,this.index+this.offset+this.k,#c)*;
}
setplayerprop #c,#c#s(this.remainder);
}
}
this.offset+=strlen(#t(this.j))+1;
}

}

__________________


Help me keep scripting

Last edited by TribulationStaff; 07-30-2003 at 02:34 AM..
Reply With Quote
 


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 05:52 PM.


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