|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
ON *:TEXT:!badword add*:#spelops:{
write badwords.ini $2-
echo -a $2
}
Ok, this works, the first one, it write the ini and puts the badword ($2-) in it, but this is the problem : ON *:TEXT:*:#spelops:{
if $2- isin $read(badwords.ini)
kick $chan $nick Don't swear!
}
Cause then i get : * /if: insufficient parameters (line 129, script5.ini)
somebody know's what the problem is?
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
First of all, that's not how you use an INI file. You should probably use a TXT file instead. Yes, it won't hurt anything, but if you're new to scripting, you should use the correct files.
As far as searching for matches, you'll need to use a loop to loop through $1, $2, $3, etc. until the end of the line. And, for searching, use $read(filename.txt,w,$1) or whatever. You could use "s" instead of "w", but for this situation, "w" works better.
I don't have time to write it for you right now, but maybe that will get you started.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Hmm, i dont get that... (it)
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 1,156
Hoopy frood
|
Hoopy frood
Joined: Jan 2007
Posts: 1,156 |
ON *:TEXT:!badword add*:#spelops:{
hadd -m badwords $calc($hget(badwords,0).item + 1) $3-
echo -a $2
}
ON *:TEXT:*:#spelops:{
if $badw($2-) kick $chan $nick Don't swear!
}
alias badw {
var %h = $hget(badwords,0).item, %i = 1 | while (%i <= %h) {
if ($hget(badwords,%i).item isin $1-) { return $true | break }
inc %i | if (%i > %h) return $false
}
} I personally have never made a badword kicker, I dont like the while loop for every text event, but at least its better than a text file or ini file.
Last edited by DJ_Sol; 03/02/07 05:32 PM.
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
srry but then i get this : * /if: 'kick' unknown operator (line 6, script7.ini)
-
* /if: 'kick' unknown operator (line 6, script7.ini)
-
(WHILE Unknown command
-
(WHILE Unknown command
and the echo does :
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 1,156
Hoopy frood
|
Hoopy frood
Joined: Jan 2007
Posts: 1,156 |
Well the echo yeah, it would have to be $2-. Sorry I fixed the while issue. I accidentally put an opening paren on it. 
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Olahlah!
xD
*Gonna test it*
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Now i think it works.. But it echo's AGAIN wrong xD is the echo 
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Ooh, wait i got it :
ON *:TEXT:!badword add*:#duck_power:{
hadd -m badwords $calc($hget(badwords,0).item + 1) $3-
echo -a $3-
}
ON *:TEXT:*:#duck_power:{
if $badw($3-) kick $chan $nick Don't swear!
}
alias badw {
var %h = $hget(badwords,0).item, %i = 1 | while (%i <= %h) {
if ($hget(badwords,%i).item isin $1-) { return $true | break }
inc %i | if (%i > %h) return $false
}
now it echo's good, but the kick? *looks* nopes.. * /if: 'kick' unknown operator (line 6, script4.ini)
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Cause it doesn't writed the .txt/.ini
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
For one, you're missing the ending } as shown in the code given to you. Here is another version of the code:
on *:start: {
hmake badwords 10
if ($isfile(badwords.hsh)) { hload badwords badwords.hsh }
}
ON *:text:!badword add &:#duck_power:{
hadd -m badwords $3
hsave badwords badwords.hsh
echo -a Added: $3
}
ON *:text:*:#duck_power:{
if ($badw($1-)) { kick $chan $nick Don't swear! }
}
alias badw {
var %h = $hget(badwords,0).item, %i = 1
while (%i <= %h) {
if ($hget(badwords,%i).item isin $1-) { return $true }
inc %i
}
return $false
}
And, as he said, you don't need to write to a file... hash tables are faster. Just remember that a script like this can kick someone for typing a good word if you choose to include poor bad words. For example, if someone types "compass", they could be kicked due to the ending of the word.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Weird... Cause now i get : * /if: 'kick' unknown operator (line 17, ZoekBericht.ini)
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 259
Fjord artisan
|
Fjord artisan
Joined: Jan 2007
Posts: 259 |
Add () around all your if statements and the problem will be solved.
Those who can, cannot. Those who cannot, can.
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Wait, from that code from Ramsius or from that other guy?
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 259
Fjord artisan
|
Fjord artisan
Joined: Jan 2007
Posts: 259 |
ON *:TEXT:!badword add*:#duck_power:{
hadd -m badwords $calc($hget(badwords,0).item + 1) $3-
echo -a $3-
}
ON *:TEXT:*:#duck_power:{
if ($badw($3-)) kick $chan $nick Don't swear!
; Added ()s
}
alias badw {
var %h = $hget(badwords,0).item, %i = 1 | while (%i <= %h) {
if ($hget(badwords,%i).item isin $1-) { return $true | break }
inc %i | if (%i > %h) return $false
}
}
Those who can, cannot. Those who cannot, can.
|
|
|
|
Joined: Jan 2007
Posts: 1,156
Hoopy frood
|
Hoopy frood
Joined: Jan 2007
Posts: 1,156 |
IM "that other guy" huh? Im hurt! :p
ON *:TEXT:*:#spelops:{ if ($badw($1-)) kick $chan $nick Don't swear! }
This should work fine.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
The one I gave you allows saving of the data so that you don't need to add the words everytime you start mIRC.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Still weird.. xD
Andah, srry Dj_SOL xD (though you were a guy xD)
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2007
Posts: 280 |
Hey, i've changed id.. i found it, look:
on *:TEXT:*:#spelletjes, #games, #axespeaks: {
if ($nick isreg #) {
set %ln 1
while %ln <= $lines(badwords.txt) {
if ($read(badwords.txt,%ln) isin $strip($1-)) {
kick $chan $nick KICK: Let op je woorden... [Banned] | mode $chan +b $address($nick,2)
}
inc %ln
}
}
}
on *:NOTICE:!badword*:* {
if (( $nick isop #spelletjes ) || ($nick ishop #spelletjes)) {
write badwords.txt $2
notice $nick $2 Toegevoegd aan badwords lijst
}
}
This works on : /notice (my nickname) !badword (badword) !!!  !!! And... it works.
Squee whenever a squee squee's. Squee whenever a squee does not squee.
|
|
|
|
|