Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-14-2003, 03:11 AM
ASouthernMan ASouthernMan is offline
Banned
Join Date: Jun 2003
Location: Alabama
Posts: 72
ASouthernMan is on a distinguished road
Send a message via ICQ to ASouthernMan Send a message via AIM to ASouthernMan Send a message via Yahoo to ASouthernMan
No Cursing Script

NPC Code:

if (actionserverside) {
if (strequals(#p(0),addstrings)) {
setstring clientr.nocurse_r1,pls,plz,brb,;
setstring clientr.nocurse_r2,please,please,"Be right back",;
setstring clientr.nocurse_p1,PUT,YOUR,CURSE,WORDS,HERE;
}
}
//#CLIENTSIDE
if (created) {
triggeraction 0,0,serverside,-Anticurse,addstrings;
}
if (playerchats) {
repeatcheck();
profanitycheck();
function repeatcheck() {
for (i=0; i<sarraylen(clientr.nocurse_r1); i++) {
this.i_r1 = indexof(#I(clientr.nocurse_r1,i),#c);
if (this.i_r1 > -1) {
setstring client.nocurse_ts,#e(0,strtofloat(#v(this.i_r1)),# c)#I(clientr.nocurse_r2,i)#e(strtofloat(#v(this.i_ r1))+strlen(#I(clientr.nocurse_r2,i))-3,-1,#c);
setplayerprop #c,#s(client.nocurse_ts);
}
}
if (this.i_rl < strlen(#c)) repeatcheck();
}
function profanitycheck() {
for (u=0; u<sarraylen(clientr.nocurse_p1); u++) {
this.i_p1 = indexof(#I(clientr.nocurse_p1,u),#c);
if (this.i_p1 > -1) {
setstring client.nocurse_st,;
for (o=0; o<strlen(#I(clientr.nocurse_p1,u)); o++) setstring client.nocurse_st,#s(client.nocurse_st)*;
setstring client.nocurse_ts,#e(0,strtofloat(#v(this.i_p1)),# c)#s(client.nocurse_st)#e(strtofloat(#v(this.i_p1) )+strlen(#s(client.nocurse_st)),-1,#c);
setplayerprop #c,#s(client.nocurse_ts);
}
}
if (this.i_p1 < strlen(#c)) profanitycheck();
}



client.nocurse_r1 and r2 are replacement strings

The "tokens" correspond to each other
Reply With Quote
  #2  
Old 06-14-2003, 03:17 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Read the rules.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #3  
Old 06-14-2003, 03:23 AM
ASouthernMan ASouthernMan is offline
Banned
Join Date: Jun 2003
Location: Alabama
Posts: 72
ASouthernMan is on a distinguished road
Send a message via ICQ to ASouthernMan Send a message via AIM to ASouthernMan Send a message via Yahoo to ASouthernMan
*shrug* It works. I'll see if I can improve it some.
Reply With Quote
  #4  
Old 06-14-2003, 03:25 AM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by ASouthernMan
*shrug* It works. I'll see if I can improve it some.
Just because something "works" does not mean it is efficient, optized, secure, or even correct.
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #5  
Old 06-14-2003, 03:26 AM
ASouthernMan ASouthernMan is offline
Banned
Join Date: Jun 2003
Location: Alabama
Posts: 72
ASouthernMan is on a distinguished road
Send a message via ICQ to ASouthernMan Send a message via AIM to ASouthernMan Send a message via Yahoo to ASouthernMan
BUT IT WORKS!!!
Reply With Quote
  #6  
Old 06-14-2003, 03:48 AM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
Yeah, I thought the whole point of functions were to make them seperate areas of script that are called via a single command. Kind of defeats the purpose if the function is inside the event.

Besides, I don't understand why you need to even call on the server... I mean it's not like somebody is going to use some sort of editor so they can get around the profanity filter, and if they did, they are stupid, because they would stick out like a sore thumb and get banned. You might as well just have a this.string list in the weapon itself, instead of calling on clientr strings.
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #7  
Old 06-16-2003, 06:34 PM
Alexander Alexander is offline
Registered User
Join Date: Apr 2003
Location: California
Posts: 246
Alexander is on a distinguished road
Send a message via AIM to Alexander
.................................................. ......
The script looks like that with the mistakes because I was trying to prove that I could script a much shorter version of someone's script using the same "layout" as in functions inside events, etc. That script was also updated 3 days ago, and is far from the same script here.
Reply With Quote
  #8  
Old 06-16-2003, 07:41 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by Alexander
.................................................. ......
The script looks like that with the mistakes because I was trying to prove that I could script a much shorter version of someone's script using the same "layout" as in functions inside events, etc. That script was also updated 3 days ago, and is far from the same script here.
Do you not understand that functions should NOT be placed within events? Hell, while loops would even be better....

NPC Code:

//#CLIENTSIDE
if (created) {
setstring this.nocurse_r1,pls,plz,brb,;
setstring this.nocurse_r2,please,please,"Be right back",;
setstring this.nocurse_p1,PUT,YOUR,CURSE,WORDS,HERE;
}
if (playerchats) {

while (this.i_rl < strlen(#c)) {
for (i=0; i<sarraylen(this.nocurse_r1); i++) {
this.i_r1 = indexof(#I(this.nocurse_r1,i),#c);
if (this.i_r1 > -1) {
setstring this.nocurse_ts,#e(0,strtofloat(#v(this.i_r1)),#c) #I(this.nocurse_r2,i)#e(strtofloat(#v(this.i_r1))+ strlen(#I(this.nocurse_r2,i))-3,-1,#c);
setplayerprop #c,#s(this.nocurse_ts);
}
}
}

while (this.i_p1 < strlen(#c)) {
for (u=0; u<sarraylen(this.nocurse_p1); u++) {
this.i_p1 = indexof(#I(this.nocurse_p1,u),#c);
if (this.i_p1 > -1) {
setstring this.nocurse_st,;
for (o=0; o<strlen(#I(this.nocurse_p1,u)); o++) setstring this.nocurse_st,#s(this.nocurse_st)*;
setstring this.nocurse_ts,#e(0,strtofloat(#v(this.i_p1)),#c) #s(this.nocurse_st)#e(strtofloat(#v(this.i_p1))+st rlen(#s(this.nocurse_st)),-1,#c);
setplayerprop #c,#s(this.nocurse_ts);
}
}
this.i_rl = 0;
this.i_p1 = 0;

}




You have to realize that most of the scripters here are trying to help you become a better scripter, not trying to keep you down. Listen to them every once in awhile.
__________________
[signature]insert here[/signature]
Reply With Quote
  #9  
Old 06-17-2003, 03:30 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
I prefer the RC program to deal with people who swear.

It helps you root out people you probably don't want playing your server anyway.
Reply With Quote
  #10  
Old 06-17-2003, 04:05 PM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
How does the RC program tell if you're swearing?
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #11  
Old 06-17-2003, 05:18 PM
Falados Falados is offline
Cucumber NPC
Falados's Avatar
Join Date: Jan 2003
Posts: 141
Falados is on a distinguished road
Send a message via ICQ to Falados Send a message via AIM to Falados
Quote:
Originally posted by Neoreno
How does the RC program tell if you're swearing?
It doesn't. I dont know what he is refering to, prehaps a feature suggestion to report swears made by people to the RC?
__________________

subliminal message: 1+1=3
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:15 PM.


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