Where you have (%words > %wd) that's bascially "if this sentence is greater than that sentence" - you can't use greater than with anything other than digits. Also, the return wouldn't do anything.
alias words {
 if (%blockwords != $true) { return $1- }
 else {
  var %words = $1-
 ;I've added %tt to have a list of bad words, rather than just one
  var %x = 1, %i = $lines(blockwords.txt), %tt = $chr(36)
  while (%x <= %i) {
   var %wd = $read(blockwords.txt,%x)
  ;if it's not there, continue with the loop, if it is, add it to the list
   if (%wd !isin %words) { inc %x }
   else { var %tt = %tt $+ , %wd | inc %x }
  }
 ;Lastly, it returns the full list of bad words
  return $remove(%tt,$chr(36))
 }
}
Edited Mar 18, 2005 11:38 AM by Cleric xtx
Thanks for the code. However, it is returning all nulls now. Even from the words that isn't in the blocked words list.
Edited Mar 18, 2005 11:52 AM by Warrior124
Ozzy10
Aerial Photographer Member #2
would be much easier using an ini file
anyway , this is tried and tested, just make sure the script and the blocked words text are in same dir
on *:TEXT:*:#: { echo -a $words($1-) }
alias words {
 var %x = 1
 while (%x <= $lines($scriptdir $+ blockwords.txt)) {
  if ($read($scriptdir $+ blockwords.txt,%x) !isin $1-) && (%x == $lines($scriptdir $+ blockwords.txt)) { return $1- | break }
  if ($read($scriptdir $+ blockwords.txt,%x) isin $1-) { return the message has been blocked as it contained profanity | break }
  inc %x
 }
}
Edited Mar 18, 2005 1:22 PM by OZZY_10â„¢
My code does NOT have bugs. It just develops random features.
if it was me i would do it this way
on *:TEXT:*:#: echo -a $words($1-)
alias words { var %x = 1 | while ($read($scriptdir $+ blockwords.txt,%x)) { if ($ifmatch isin $1-) { return the message has been blocked as it contained profanity | break } | inc %x } | return $1- }
Edited Mar 19, 2005 7:56 AM by The Gate Keeper