mIRC Homepage
Posted By: Daxter Help - 09/03/15 07:30 AM
hello, me again, i need some help, i need a anti cmd spam script.

EXAMPLE: someone keep typing !cmds over and over again in my channel, and my bot will ignore the guy(using /ignore) and after 10 seconds, the bot will /ignore -r $nick

Quote:
on *:TEXT:!*:##stormtalk:{
inc -u4 %spamc. [ $1 [ $nick ] ]
if (%spamc. [ $1 [ $nick ] ] == 4) {
/notice $nick Bot Over Flooded, please try again shortly
ignore $nick
timer.$nick 1 10 /ignore -r $nick
}
}


idk if that script is correct, please help.

and also, are there any mIRC $string/script that can generate a random word?like $rand , but that generate a random number


thx for reading
Posted By: OrFeAsGr Re: Help - 09/03/15 12:49 PM
Hey! I think that this script would work exactly as you want it but i cant test it now cause im not on PC.
The coincedence is that i recently wrote a small alias that returns random letters of the English alphabet
Code:
alias ralph {
set %alphabet a b c d e f g h i j k l m n o p q r s t u v w x y z
return $gettok(%alphabet,$rand(1,$numtok(%alphabet,32)),32)
}

In case you havent tried token identifiers before ill try explaining what i did
So.. we have %alphabet , the letters are seperated with a $null . To use token identifiers you need to find the ascii number of the char that devides your tokens.
In our case $null is 32.
So let's suppose you want to get the 5th letter in %alphabet .
$gettok(%alphabet,5,32)
The first parameter is always the text you want to edit/use.
In our case this is %alphabet .
The second parameter is the Nth token or Nth-Nth . That means you can also get the tokens 5 to 6 this way: $gettok(%alphabet,5-6,32)
The third parameter is the ascii number.
So.. now that we explained $gettok . Let's go to $numtok .
$numtok format goes like this: $numtok(%alphabet,32) .2 parameters only.
The 1st parameter is again the text we want to edit/use.. and the 2nd one is the ascii number. It returns the total number of tokens in %alphabet that are seperated by $null which is 32 in ascii numbers.
Now that we have seen both of the identifiers i used. Let's see how i used them to get what we want. A random letter.
$gettok(%alphabet,$rand(1,$numtok(%alphabet,32)),32)
So basically it's pretty simple now ha?
$rand(1,$numtok(%alphabet,32)) will return a random number between 1 and he total number of tokens seperated with $null (32) .
$gettok does the rest of the work.
I hope this was a nice tutorial!
Tokens are awesome. Take advantage of them.
Other token identifiers: $remtok , $deltok , $wildtok , $addtok , $instok , $istok
Try learning them through mIRC Help Files.
Good Luck!!
-OrFeAsGr-
Posted By: Loki12583 Re: Help - 09/03/15 12:58 PM
Or this:
Code:
alias ralph { return $chr($rand(97,122)) }
Posted By: Nillen Re: Help - 09/03/15 01:00 PM
You can use $rand(A,Z) and $rand(a,z) to return a random letter from the english alphabet.

If you want to use a word, the easiest way is to do it the way you did it though. Populate a list of words in a variable, separated by $chr(32) which is a space, not null. http://www.asciitable.com/

And then just pull a random number based between 1 and the $numtok of the string.
© mIRC Discussion Forums