|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
how do u get it to identify a word from a sentance and if that word is in a txt file?
Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
on 1:TEXT:*:#: {
/unset %match
var %word = 1
while (%word <= $numtok($1-, 32)) {
if ($read([color:Red]yourtext.txt[/color], s, $gettok($1-, %word, 32))) var %match = $addtok(%match, $gettok($1-, %word, 32), 44)
/inc %word
}
if (%match != $null) /msg $chan Found the current matching words: %match
}
that will output all matching words form the message in the channel. From there, either alter the "if($read(..." command to whatever you'd like, and remove the msg command.
-KingTomato
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
Thnax again KT
Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
-KingTomato
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
right i have done this:
on @1:TEXT:*:#botsparadise: {
/unset %match
var %word = 1
while (%word <= $numtok($1-, 32)) {
if ($read(swearwords.txt, s, $gettok($1-, %word, 32))) var %match = $addtok(%match, $gettok($1-, %word, 32), 44)
/inc %word
}
if (%match != $null) /msg $chan Do not use: < $+ $nick $+ > " $+ %match $+ " You will be kicked if it happens again | /write swearer.txt $nick
}
it doesnt work can u spot what is worng
Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 169 |
Can you show us a snippet of your swearwords.txt file?
$read(file,s,word) scans for lines beginning with that word. Your text file needs to have each swear on an individual line.
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
That what it is it like and like that with out the stars
Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Well, i made a swear detection system that ises a hash table if you are interested. You can set how harsh youd like the action to be taken, and what words yo add. Find it at: http://www.kingtomato.com/files/swearing.zip
-KingTomato
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
Yeah i had a look at that and its not realy what im lookin for so i decided to try my own
Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Well i made an update. It now uses a dialog, not a popup. Much easier to edit and alter words and their actions
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 169 |
Ok, another stupid question. Is the swear word file in the same directory as the script?
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 169 |
Bah, $read(file,s,word) returns all the text AFTER word. Check $readn instead. on @1:TEXT:*:#botsparadise: {
var %i = 1
while (%i <= $0) {
.!echo -q $read($scriptdirswearwords.txt,s,$eval($+($,%i),2))
if ($readn) { var %match = $addtok(%match,$eval($+($,%i),2),44) }
inc %i
}
if (%match != $null) {
msg $chan Do not use: < $+ $nick $+ > " $+ %match $+ " You will be kicked if it happens again
}
}
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
ok then done that also i have added a few things will they work
on @1:TEXT:*:#botsparadise: {
var %i = 1
while (%i <= $0) {
.!echo -q $read($scriptdirswearwords.txt,s,$eval($+($,%i),2))
if ($readn) { var %match = $addtok(%match,$eval($+($,%i),2),44) }
inc %i
}
[color:red] if ($read(swearers.txt,s,$nick) && if($nick !isop #)) {
if ($ifmatch != $null) {
kick $chan $nick You Were Warned
elseif (%match != $null) {
[/color] msg $chan Do not use: < $+ $nick $+ > " $+ %match $+ " You will be kicked if it happens again | write swearers.txt $nick
}
}
}
}
cos i need it to make sur it doesnt do anythin to the ops and if the persons nick is in a txt file it will kick them
Last edited by andymps; 10/06/03 08:34 PM.
Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 169 |
I would put "if ($nick !isop $chan)" at the top so it skips the entire thing if the person is opped. You also need to put an "if (%match) {" in there. on @1:TEXT:*:#botsparadise: {
if ($nick !isop $chan) {
tokenize 32 $strip($1-)
var %i = 1
while (%i <= $0) {
.!echo -q $read($scriptdirswearwords.txt,s,$eval($+($,%i),2))
if ($readn) { var %match = $addtok(%match,$eval($+($,%i),2),44) }
inc %i
}
; You need this so you don't take any action of no swears were spoke by $nick
if (%match) {
.!echo -q $read($scriptdirswearers.txt,s,$nick)
if ($readn) { kick $chan $nick You Were Warned }
else {
msg $chan Do not use: < $+ $nick $+ > " $+ %match $+ " You will be kicked if it happens again
write $scriptdirswearers.txt $nick
}
}
}
} Personally, I would use a hash table for both the swear word file and to keep track of who triggered it. Otherwise you have to at some time clean up swearers.txt. Also, if the person switches nicks then they will get away with a warning instead of a kick. Here is a sample script that uses a hash table to store who has sworn. on @1:TEXT:*:#botsparadise: {
if ($nick !isop $chan) {
tokenize 32 $strip($1-)
var %i = 1
while (%i <= $0) {
.!echo -q $read($scriptdirswearwords.txt,s,$eval($+($,%i),2))
if ($readn) { var %match = $addtok(%match,$eval($+($,%i),2),44) }
inc %i
}
if (%match) {
if ($hget(SwearKicked) == $null) { hmake SwearKicked 100 }
if ($hfind(SwearKicked,$fulladdress,1,W)) {
var %item = $ifmatch , %val = $hget(SwearKicked,%item)
if (%val > 5) { ban $chan $nick 2 | kick $chan $nick You were warned %val times! Now you are banned! }
else { kick $chan $nick You were warned %val time $+ $iif(%val > 1,s) $+ ! }
hinc -u7200 SwearKicked %item 1
}
else {
hadd -u7200 SwearKicked $+(*!*,$address) 1
msg $chan Do not use: < $+ $nick $+ > " $+ %match $+ " You will be kicked if it happens again
}
}
}
} It will add their address to a hash table (to avoid people escaping by changing nicks) and each entry will expire after 2 hours. It will warn with a msg the first time, kick after warnings 1-5, and ban the user after.
|
|
|
|
Joined: Dec 2002
Posts: 191
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 191 |
$read(file,s,word) scans for lines beginning with that word. Your text file needs to have each swear on an individual line.
As long as there is more than one word in the line it will return the rest of the line less the text you uesd as the matchtext, by using $read(file,w,word) it will still return the line even when the line only has the one word.
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 169 |
Ah yes. I didn't think to use the w option without any wildcards. That makes it a line or so smaller. .!echo -q $read($scriptdirswearwords.txt,s,$eval($+($,%i),2))
if ($readn) { var %match = $addtok(%match,$eval($+($,%i),2),44) } to if ($read($scriptdirswearwords.txt,w,$eval($+($,%i),2))) { var %match = $addtok(%match,$ifmatch,44) } In case the original poster is still watching this thread
|
|
|
|
|