Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   No Cursing Script (https://forums.graalonline.com/forums/showthread.php?t=45468)

ASouthernMan 06-14-2003 03:11 AM

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

osrs 06-14-2003 03:17 AM

Read the rules. :)

ASouthernMan 06-14-2003 03:23 AM

*shrug* It works. I'll see if I can improve it some.

Tseng 06-14-2003 03:25 AM

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.

ASouthernMan 06-14-2003 03:26 AM

BUT IT WORKS!!!

konidias 06-14-2003 03:48 AM

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.

Alexander 06-16-2003 06:34 PM

.................................................. ......
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.

screen_name 06-16-2003 07:41 PM

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.

protagonist 06-17-2003 03:30 PM

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.

Neoreno 06-17-2003 04:05 PM

How does the RC program tell if you're swearing?

Falados 06-17-2003 05:18 PM

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?


All times are GMT +2. The time now is 06:45 AM.

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