mIRC Home    About    Download    Register    News    Help

Print Thread
#96749 05/09/04 06:40 AM
Joined: Dec 2002
Posts: 27
J
Jon Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Dec 2002
Posts: 27
I want to make a simple scripts, but get stuck

on *:text:*:#: {
if ($len($1-) => 300 ) now i'm stuck

i want that , if in 10 secs, any one that post two time of ($len($1-) => 300 ) then do something .
but don't need to be the same nick post two times, any nick if post two time with the same sentences (mean exact the same) then command do some thing
for example like, nickA post a long sentens, and another nickB copy that repost one more time, then my mirc will notice that "please don't do that"

But time just only 10 secs, if after 10 secs then just { halt }

Is that anyway doing it with out using Variables, because it will make the mirc run crazy .

thanks for help

Last edited by Jon; 05/09/04 06:46 AM.
#96750 05/09/04 07:47 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Code:
;on text event
on *1:TEXT:*:#: {
  ; check for length >= (greater or equal) to 300
  if ($len($1-) >= 300) {
    ; check if the message matche the previous one
    if ($1- == %lastMsg) /msg $chan Please don't do that.
    else {
      ; use the /set command with the -u parameter (unset after N seconds)
      ; and make it increase once per N seconds. This makes it so if they say
      ; something twice before the variable unsets, then perform an action
      /set -u10 %lastMsg $1-
    [color:blue]}[/color]
  }
}


Think that is what you want. I've commented to explain it as I went, hope it helps. Also, copy the code to wordpad (start->run->"wordpad", then [OK]), then reselect it, copy it again, and paste to mIRC.

EDIT: Missing a brace (})

Last edited by KingTomato; 05/09/04 08:25 AM.

-KingTomato
#96751 05/09/04 08:22 AM
Joined: Dec 2002
Posts: 27
J
Jon Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Dec 2002
Posts: 27
thanks alot KingTomato
That what i want to do

But let me test on it

thanks again

#96752 05/09/04 08:38 AM
Joined: Dec 2002
Posts: 27
J
Jon Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Dec 2002
Posts: 27
to KingTomato
It only work on the same nick, for exaple nickA just type a long message
then after that another nick copy and repost that message again, it wont work .

it work, if and only if same nick post two time

how can i fix that ?

jon

#96753 05/09/04 09:42 AM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Code:
on *:START:{ hmake -s 50 longline | set %longlinecounter 1 }
on *:TEXT:*:[color:purple]#chanA,#chanB[/color]:{
  if ($len($1-) >= 300) {
    if ($hfind(longline,$1-,1).data) {
[color:orange]      if (%longlinetimeout > 4) {
        inc -z %longlinetimeout 3[/color]
        notice $nick Please don't repeat long lines
[color:orange]      } [/color]
    }
    else {
      inc %longlinecounter
      [color:blue]if (%longlinecounter > 1000000) set %longlinecounter 1[/color]
      hadd -u10 longline %longlinecounter $1-
    }
  }
}


Change the purple text to your own channel(s) you want to monitor.
Remove or replace the orange text with your own flood protection stuff if needed.
The blue text is only really needed if you have a very busy channel and mIRC runs 24/7 for weeks...
Also note that i have not put in a check if you have ops, it will work if you're not an op, but make sure you have permission from them before using this script in their channel...

#96754 05/09/04 01:09 PM
Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
There's something wrong with the orange part, as %longlinetimeout is never set or increased outside the if statement so as to become > 4. The script will never enter the if statement.

Also, avoid using hfind. It'll make the hash table slow down a lot for no reason! You could use:
hadd -u10 longline $hash($1-,32) %longlinecount
and then as simple if $hget(longline,$hash($1-,32) ) != $null
Besides you don't use it as data! You just want to know if it's there!

Be well!

Edit:
Code:
on *:START:{ hmake -s 50 longline }
on *:TEXT:*:#chanA,#chanB:{
  if ($len($1-) >= 300) {
    hinc -u[color:blue]10[/color] longline $hash($1-,32)
    if $hget(longline,$hash($1-,32)) >= [color:red]2[/color] {
      notice $nick Please don't repeat long lines
      hdel longline $hash($1-,32)
    } 
  }
} 


Blue is the amount of seconds.
Red is the amount of repetitions allowed in this period of time.

Last edited by dr_Eamer; 05/09/04 01:20 PM.

Maybe I wake up one day to notice that all my life was just a dream!
#96755 05/09/04 10:11 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
For the orange part: it can becom >4 if 2 notices are sent within 2 seconds. If the channel gets busy where 3 different repeats are received within 5 seconds or so, only 2 notices are sent...

As for using $hash: I didn't use it because then you're storing hash values in a hash table. Seems perfect at first, but if you think about it smile


#96756 06/09/04 10:27 AM
Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
It makes sense now but still it should be:
if (%longlinetimeout < 4)

The only reason I use the $hash identifier is to "shrink" the item name.
If the sentence is 300 characters long then the name (or in your case the value) will also be 300 characters long which is unecessary and impractical, a waste of space and blah blah... I can find a thousand cons... Instead of this, $hash gives you a single number!
The only disadvantage is that two seemingly irrelevant sentences may give the same hash number but given a big-enough number of bits, this will only happen very rarely, if not never!
Why does the double hashing bother you? After all $hash is very fast!


Maybe I wake up one day to notice that all my life was just a dream!
#96757 07/09/04 09:19 AM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
* Kelder blames it on the full moon

It's < 4 indeed blush


Link Copied to Clipboard