Hoopy frood
Joined: Feb 2003
Posts: 806 |
%flood . [ $+ [ $nick ] ] is a perfectly good way to set a variable, so I'm not sure what you mean with that comment. And I thought it was a typo.. but no, it's wrong. %flood. [ $+ [ $nick ] ] is a perfectly good way to set and get a variable, %flood . [ $+ [ $nick ] ] is not. The second one (yours) increases the variable %flood and ignores the rest (" . $+ $nick"). Did you actually test your code before posting? Let's test it, changing $nick by $me, so I can put it in an alias. Things in green are correct, things in brown (your way) are not. alias wrong {
; *** Try this in a totally clean mIRC. ***
; *** Type /wrong ***
clear -s
window -a "status window"
echo 3 -s -> Command: $(set -s %flood. $+ $me correct,)
[color:green]set -s %flood. $+ $me correct[/color]
echo 3 -s -> should echo "* Set $+(%,flood.,$me) to correct"
echo -s ------------------------------------------------------
echo 5 -s -> Command: $(unset -s %flood . [[ $+ [[ $me ]] ],)
[color:brown]unset -s %flood . [ $+ [ $me ] ][/color]
echo 5 -s -> should echo "* Unset $+(%,flood.,$me) $+ ", $&
but nothing appears, since it's actually trying to unset $&
$(%flood,) which doesn't exist
echo -s ------------------------------------------------------
echo 5 -s -> Command: $(inc -s %flood . [[ $+ [[ $me ]] ],)
[color:brown]inc -s %flood . [ $+ [ $me ] ][/color]
echo 5 -s -> should echo "* Inc $+(%,flood.,$me) to 1", but $&
echoes "* Inc $(%flood,) to 1"
echo -s ------------------------------------------------------
echo 5 -s -> Command: $(set -s %flood . [[ $+ [[ $me ]] ]] wrong,)
[color:brown]set -s %flood . [ $+ [ $me ] ] wrong[/color]
echo 5 -s -> should echo "* Set $+(%,flood.,$me) to wrong", $&
but echoes "* Set $(%flood,) to .cold wrong"
echo -s ------------------------------------------------------
echo 3 -s $!iif(%flood. [[ $!+ [[ $!me ]] ]] == correct,correct,wrong) $&
returns $+(", $iif([color:green]%flood. [ $+ [ $me ] ][/color] == correct,correct,wrong) ,")
echo 5 -s $!iif(%flood . [[ $!+ [[ $!me ]] ]] == correct,correct,wrong) $&
returns $+(", $iif([color:brown]%flood . [ $+ [ $me ] ][/color] == correct,correct,wrong) ,")
echo -s ------------------------------------------------------
echo 3 -s -> $($($+(%,flood.,$me),2),) returns $+(", [color:green]$($+(%,flood.,$me),2)[/color] ,")
echo 3 -s -> $(%flood. [[ $+ [[ $me ]] ],) returns $+(", [color:green]%flood. [ $+ [ $me ] ][/color] ,")
echo 5 -s -> $(%flood . [[ $+ [[ $me ]] ],) returns $+(", [color:brown]%flood . [ $+ [ $me ] ][/color] ,")
echo 5 -s -> $(%flood,) returns $+(", %flood ,")
echo -s ------------------------------------------------------
unset %flood*
} My results: [color:brown][color:green]-> Command: set -s %flood. $+ $me correct
-
* Set %flood.cold to correct
-
-> should echo "* Set %flood.cold to correct"[/color]
[color:black]------------------------------------------------------[/color]
-> Command: unset -s %flood . [ $+ [ $me ] ]
-> should echo "* Unset %flood.cold", but nothing appears, since it's
actually trying to unset %flood which doesn't exist
[color:black]------------------------------------------------------[/color]
-> Command: inc -s %flood . [ $+ [ $me ] ]
-
* Inc %flood to 1
-
-> should echo "* Inc %flood.cold to 1", but echoes "* Inc %flood to 1"
[color:black]------------------------------------------------------[/color]
-> Command: set -s %flood . [ $+ [ $me ] ] wrong
-
* Set %flood to .cold wrong
-
-> should echo "* Set %flood.cold to wrong", but echoes "* Set
%flood to .cold wrong"
[color:black]------------------------------------------------------[/color]
[color:green]-> $iif(%flood. [ $+ [ $me ] ] == correct,correct,wrong) returns "correct"[/color]
-> $iif(%flood . [ $+ [ $me ] ] == correct,correct,wrong) returns "wrong"
[color:black]------------------------------------------------------[/color]
[color:green]-> $($+(%,flood.,$me),2) returns "correct"
-> %flood. [ $+ [ $me ] ] returns "correct"[/color]
-> %flood . [ $+ [ $me ] ] returns ".cold wrong .cold"
-> %flood returns ".cold wrong"
[color:black]------------------------------------------------------[/color][/color] (Sorry it's big, but it clears my point) /silence is not a mIRC command, but is provided by the network you are on, so it does'work on some (like DALnet) and not others (like Efnet) /me agrees. And that's why I said I wouldn't use it (" /silence does, but I don't know if it's supported on most networks, so I won't use it here"). I just mentioned it. Third, if you are worried about users sending you a valid message in those 5 measely seconds you are ignoring everything, then you should get your priorities straightened out. If a channel flood occurs, the only thing that matters is stopping it. And if you're that worried about missing a query, just ignore the channel alone then. Yeah, I agree. Ignoring *!*@* with the -c switch should be fine. But I'd also ignore the flooder's address, for more than 5 secs. So, the code would be changed to:
on @*:TEXT:*:#:{
inc -u5 $+(%,flood;,$address,;,$chan)
if ( [ [ $+(%,flood;,$address,;,$chan) ] ] > 4) {
ignore -cu5 *
ban -k $chan $nick 3 Stop flooding dude
ignore -u60 $nick 3
}
}
|