Jump to content

Question

Posted (edited)

done

 

Edit :

Request to modify an announcer script to filer bad words like "fuck","damn"  and etc.

 

Edited by Emistry
Added original purpose for topic being created.

10 answers to this question

Recommended Posts

  • 1
Posted

try this...

http://pastebin.com/raw.php?i=euHQksK6

 

edit the setting here

OnInit:
// required item
.item_id = 671;
.item_quantity = 1;

// Colour Name List
setarray .color_name$,"RED","BLUE";
setarray .color_code$,"FF0000","0055FF";
.color_name_menu$ = implode( .color_name$,":" );

// Filter Words
setarray .filter_word$,"fuck","you";
.filter_word_check$ = ":"+implode( .filter_word$,":" )+":";
  • Upvote 3
Posted (edited) · Hidden by Emistry, April 1, 2013 - Author removed the contents.
Hidden by Emistry, April 1, 2013 - Author removed the contents.

1

Edited by Help-Help
Stop making "Double"/"Triple"/"Quadraple" Post of yours.
Posted

the script shown in Post#6 is a working example and simplified/enhanced version of your original script.

it wont work if you just simply copy part of the script and put in your script as you dont know how it works.

 

and stop spam on your topic. bump for topic are only available once every 24 hours and please make use of "EDIT BUTTON" if you wanna add somethings.

Posted (edited)

dude i having error with this script im using eathena :)

prontera,155,181,5	script	Sample	757,{
mes "Hello, ^F509DE"+strcharinfo(0)+"^000000";
mes "Do you want to broadcast something? Payment is^FAEB60 "+.item_quantity+" "+getitemname( .item_id )+"^000000.";
if( countitem( .item_id ) >= .item_quantity ){
	next;
	if( select( "YES","NO" ) == 1 ){
		mes "Enter messages.";
		mes "Blocked words will be auto filtered.";
		input .@message$;
		explode( .@message_array$,.@message$," " );
		.@message_array_size = getarraysize( .@message_array$ );
		for( .@i = 0; .@i < .@message_array_size; .@i++ )
			if( compare( .filter_word_check$,":"+.@message_array$[.@i]+":" ) )
				.@message_array$[.@i] = "***";
		mes "Select a Color";
		.@color = select( .color_name_menu$ ) - 1;
		delitem .item_id,.item_quantity;
		announce "[ "+strcharinfo(0)+" ]:"+implode( .@message_array$," " ),0,"0x"+.color_code$[.@color];
	}
}
close;

OnInit:
// required item
.item_id = 671;
.item_quantity = 1;

// Colour Name List
setarray .color_name$,"RED","BLUE";
setarray .color_code$,"FF0000","0055FF";
.color_name_menu$ = implode( .color_name$,":" );

// Filter Words
setarray .filter_word$,"fuck","you";
.filter_word_check$ = ":"+implode( .filter_word$,":" )+":";
end;
}
Edited by Help-Help
Posted

@help-help

use rAthena ... else there would be alot things you have to change to make it compatible in non-rAthena emulator.

 

@fbrulz

just add at the array part...

// Filter Words
setarray .filter_word$,"fuck","you";
Posted (edited)

gonryun,156,122,5	script	Broadcaster	901,{

mes "[ ^FE021BMerme^000000 ]";

mes "Hello, ^F509DE"+strcharinfo(0)+"^000000";

mes "Do you want to broadcast something? Payment is^FAEB60 1 Gold Coins^000000.";

menu "Yes please.",-,"No",no;

if((countitem(.payitem)<.payamt)) goto exit2;

next;

mes "[ ^FE021BMerme^000000 ]";

mes "We Have Color Please choose!";

for(set .@i,0; .@i<getarraysize(.colormenu$);set .@i,.@i+1){

set .@menu$,.@menu$+.colormenu$[.@i]+":";

} set .@menu$,.@menu$+"Cancel";

if(select(.@menu$)>getarraysize(.colormenu$)) goto no;

next; mes "[ ^FE021BMerme^000000 ]";

mes "Type your message and it will be heard miles away!";

input .@message$; setarray .@a$,callfunc("str_explode","@explosion$[0]",.@message$," ");

for(set .@a,0;.@a<getarraysize(@explosion$);set .@a,.@a+1){

for(set .@i,0;.@i<getarraysize(.bad_words$);set .@i,.@i+1){

if(compare(@explosion$[.@a],.bad_words$[.@i])) {

while(getstrlen(@explosion$[.@a])>getstrlen(.@tmp$)){

set .@tmp$,.@tmp$+.filter$;

} set @explosion$[.@a],.@tmp$;

}

}

if(!.@a){

callfunc "str_toarray", @explosion$[.@a], "@tmp$[0]";

set @tmp$[0],callfunc("str_changecase", @tmp$[0], 1);

set @explosion$[.@a],""; set .@i,0;

while(getstrlen(@explosion$[.@a])<getarraysize(@tmp$)){

set @explosion$[.@a],@explosion$[.@a]+@tmp$[.@i];

set .@i,.@i+1;

}

}

set .@message2$,.@message2$+" "+@explosion$[.@a];

}

delitem .payitem,.payamt;

announce ""+strcharinfo(0)+":"+.@message2$+" ",bc,"0x"+.hexcolors$[(@menu-1)];

close;

no:

next;

mes "[ ^FE021BMerme^000000 ]";

mes "Oh that's a bummmer.";

mes "Come back when you need me. ^_^";

close;

exit2:

next;

mes "[ ^FE021BMerme^000000 ]";

mes "Sorry you don't have enough coins to make the broadcast.";

mes "Please come again.";

close;

OnInit:

setarray .colormenu$[0],"Red","Black","Blue","Green","Purple","Pink","Gray","Orange";

setarray .hexcolors$[0],"FF0000","000000","0000FF","00FF00","9900FF","FF33FF","888888","FF6600";

setarray .bad_words$[0],"tang ina mo", "gago", "tanga", "bobo", "mother fucker", "fuck you", "noob", "asshole", "putang ina mo", "puta", "bitch", "fuck", "fucker";

set .payitem,671;

set .payamt,1;

set .filter$,"*"; //Will be repeated to match the length of given string.

}

function script str_explode {

if ( getarg(2,"") == "" )

return callfunc("str_toarray", getarg(1), getarg(0) );

sleep2 1;

setarray .@char$, getarg(2),

" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",

"e", "i", "a", "s", "r", "n", "t", "o", "u", "l", "c",

"p", "m", "d", "v", "h", "g", "f", "b", "y", "q", "k",

"z", "x", "j", "w", "_", "-", ".", ",", ";", "*";

set .@charsize, getarraysize(.@char$);

set .@tmp$, "|~key~|";

set .@str$, .@tmp$ + getarg(1) ;

set .@len, getstrlen(getarg(1));

set .@parse_len, getstrlen(getarg(2));

while( .@len > .@s ) {

set .@i, 0 ;

while( .@i < .@charsize ) {

if ( ! ( set(.@l,.@l+1) % 600) )

sleep2 1;

if ( compare( .@str$ , .@tmp$ + .@char$[.@i] ) ) {

set .@tmp$, .@tmp$ + .@char$[.@i];

if ( .@i )

set .@arr$[.@p], .@arr$[.@p] + .@char$[.@i];

else {

set .@p, .@p + 1;

set .@s, .@s + .@parse_len-1 ;

}

break;

}

set .@i, .@i+1 ;

}

if ( .@i == .@charsize ) return 0;

else set .@s, .@s+1 ;

}

deletearray getd(getarg(0)), 128;

copyarray getd(getarg(0)), .@arr$, .@p+1;

return .@p+1;

}

function script str_charat {

sleep2 1;

setarray .@char$[ 0 ],

" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",

"e", "i", "a", "s", "r", "n", "t", "o", "u", "l", "c",

"p", "m", "d", "v", "h", "g", "f", "b", "y", "q", "k",

"z", "x", "j", "w", "_", "-", ".", ",", ";", "*";

set .@charsize, getarraysize(.@char$);

set .@tmp$, "|~key~|";

set .@str$, .@tmp$ + getarg(0) ;

set .@len, getstrlen(getarg(0));

set .@pos, getarg(1);

if ( .@pos >= .@len ) return "";

while( .@len>.@s ) {

set .@i,0;

while( .@i<.@charsize ) {

if ( ! ( set(.@l,.@l+1) % 650) )

sleep2 1;

if ( compare( .@str$ , .@tmp$ + .@char$[.@i] ) ) {

set .@tmp$, .@tmp$ + .@char$[.@i];

if ( .@s == .@pos ) return .@char$[.@i] ;

else break;

}

set .@i, .@i+1;

}

if ( .@i == .@charsize ) return 0;

else set .@s, .@s+1;

}

deletearray getd(getarg(1));

copyarray getd(getarg(1)), .@arr$, .@len;

return "";

}

function script str_changecase {

sleep2 1;

if ( getarg(1) ) {

setarray .@char$[ 0 ],

" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",

"E", "I", "A", "S", "R", "N", "T", "O", "U", "L", "C",

"P", "M", "D", "V", "H", "G", "F", "B", "Y", "Q", "K",

"Z", "X", "J", "W", "_", "-", ".", ",", ";", "*";

}

else {

setarray .@char$[ 0 ],

" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",

"e", "i", "a", "s", "r", "n", "t", "o", "u", "l", "c",

"p", "m", "d", "v", "h", "g", "f", "b", "y", "q", "k",

"z", "x", "j", "w", "_", "-", ".", ",", ";", "*";

}

set .@charsize, getarraysize(.@char$);

set .@str$, "|~key~|" + getarg(0) ;

set .@len, getstrlen(getarg(0));

while( .@len>.@s ) {

set .@i,0;

while( .@i<.@charsize ) {

if ( ! ( set(.@l,.@l+1) % 650) )

sleep2 1;

if ( compare( .@str$ , "|~key~|" + .@tmp$ + .@char$[.@i] ) ) {

set .@tmp$, .@tmp$ + .@char$[.@i];

break;

}

set .@i, .@i+1;

}

if ( .@i == .@charsize ) return "";

else set .@s, .@s+1;

}

return .@tmp$;

}

function script str_toarray {

sleep2 1;

if ( getstrlen( getarg(0) ) > 128 ) return 0;

setarray .@char$[ 0 ],

" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",

"e", "i", "a", "s", "r", "n", "t", "o", "u", "l", "c",

"p", "m", "d", "v", "h", "g", "f", "b", "y", "q", "k",

"z", "x", "j", "w", "_", "-", ".", ",", ";", "*";

set .@charsize, getarraysize(.@char$);

set .@tmp$, "|~key~|";

set .@str$, .@tmp$ + getarg(0) ;

set .@len, getstrlen(getarg(0));

while( .@len>.@s ) {

set .@i,0;

while( .@i<.@charsize ) {

if ( ! ( set(.@l,.@l+1) % 650) )

sleep2 1;

if ( compare( .@str$ , .@tmp$ + .@char$[.@i] ) ) {

set .@tmp$, .@tmp$ + .@char$[.@i];

set .@arr$[.@s], .@char$[.@i];

break;

}

set .@i, .@i+1;

}

if ( .@i == .@charsize ) return 0;

else set .@s, .@s+1;

}

deletearray getd(getarg(1));

copyarray getd(getarg(1)), .@arr$, .@len;

return .@len;

}

Works with eAthena etc etc. Edited by Skorm
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...