mIRC Homepage
Posted By: Chazzy anti timer - 10/05/14 12:20 PM
Hello , i need a script anti timer .
After 3-4 times when the user say "mesaj" on the chann at the same period of time the script notify me ... can it be done ? i`am a noob and all i try don`t work ...

pls can enyone help me ? laugh
Posted By: Nillen Re: anti timer - 10/05/14 12:23 PM
Please explain more detailed, I could not understand a single thing of what you just said.

You want someone a script to notify you if a user mentions "Mesaj" 3-4 times during a set period of time from the first mention?
Also, how do you want to be notified? Popup? Sound? Highlight?
Posted By: Chazzy Re: anti timer - 10/05/14 12:32 PM
i need script anti timer .
on the channel when a user write 3-4 msg one after another in the same period of time between posts the script notify me about this user .
i`am sry , my eng is bad ....
u understand ? :-s
Posted By: Chazzy Re: anti timer - 10/05/14 12:45 PM
let me give u a exemple :
(14:20:00)USER : this is msg on the cannal
....
(14:21:00)USER : this is a new msg
...
(14:22:00)USER : or the same msg
....
(14:23:00)USER : this is msg no 4

-----------
after the USER send 4 msg on the channel at the same period of time ( in this case 1 minutes ) the script notify me : USER on the CHANNEL send LAST 4 msg with the same period of time between .


Posted By: Nillen Re: anti timer - 10/05/14 12:56 PM
Code:
on *:text:*:#: { 
  var %time $iif($readini(messages.ini,$nick,%time),$v1,$ctime)
  var %duration $calc($ctime - %time)
  if (%duration > 60) { remini messages.ini $nick | return }
  var %ID $iif($readini(messages.ini,$nick,ID),$v1,$null)
  inc %ID
  writeini messages.ini $nick TIME $ctime
  writeini messages.ini $nick ID %ID
  writeini messages.ini $nick %ID $1-
  if (%ID == 4) {
    echo 3 -a $nick has messaged 4 times in the past 4 minutes with maximum 60 seconds intervals.
    var %n 1
    while (%n < 5) {
      echo 4 -a $readini(messages.ini,$nick,%n)
      inc %n
    }
    remini messages.ini $nick
  }
}


EDIT: If by some chance you want it to only trigger when the time has gone EXACTLY 60 seconds, change (%duration > 60) to (%duration != 60)
Posted By: Chazzy Re: anti timer - 10/05/14 05:20 PM
Ths very much .
But the problem is ... this script will notify me if the "user" msg on the channal 4 time in the last 4 minutes . I need te notify me ONLY if the "user" msg on the channel 4 times with the same intervals .
If a "user" use "/timer 10 700 /msg # message " i need the script notify me after first 4 time : "user" have last 4 post with exacly 11 minutes and 40 seconds interval.
But the 700 seconds is not exacly ... they can use 720...680...
My eanglish is bad, i know ... i try to exprim myself how i can. The very very much .
Posted By: blessing Re: anti timer - 10/05/14 05:30 PM
@Nillen
I think what he wants is a script that can detect users who use the timer in the channel. Interval can be varied and is not always 1 minute. For example: user1 may use timer with 1 minute interval, but user2 may use timer with 3 minute interval. He wants to be able to detect both user1 and user2.

@Chazzy
Could you show your code? You said that you already tried to make it.
Posted By: Chazzy Re: anti timer - 10/05/14 05:54 PM
Yes blessing .
My script... after my script have crush my irc client i delete him and ask for help here... i.am noob but i want to learn smile
Ths again very very very much
Posted By: Nillen Re: anti timer - 10/05/14 06:32 PM
Ah, I see, that makes more sense now. Never even crossed my mind. Now the title makes sense too.. /facepalm
So how about something like this?
Code:
on *:text:*:#: { 
  var %ID $iif($readini(messages.ini,$nick,ID),$v1,$null)
  inc %ID
  writeini messages.ini $nick ID %ID
  writeini messages.ini $nick %ID $ctime 
  remini messages.ini $nick $calc(%ID - 4)
  remini messages.ini $nick $calc(%ID - 4) $+ .Difference
  var %difference $calc($readini(messages.ini,$nick,%ID) - $readini(messages.ini,$nick,$calc(%ID - 1)))
  writeini messages.ini $nick %ID $+ .Difference %difference
  if (%ID $+ .Difference == $calc(%ID - 1) $+ .Difference) && (%ID $+ .Difference > 30) echo 4 -a Match found by $nick $+ . The difference are both exactly $v1 $+ !
}
Posted By: Chazzy Re: anti timer - 10/05/14 07:23 PM
I don't understand why it is not working ... i don't understand a big part of it (script) because i.am e new and noob smile but i can't make it working frown
Posted By: Nillen Re: anti timer - 10/05/14 07:28 PM
First of all you want to create a new script file. Open your scripts editor (ALT + R) and click File > New.
Paste the script in there and it should work.

It's likely that you left another instance of
Code:
on *:text:*:#:
in your remote.ini, rendering all other text events useless.
Posted By: Chazzy Re: anti timer - 10/05/14 07:55 PM
Invalid format: $calc (line 8, script1.ini) ...
Posted By: Nillen Re: anti timer - 10/05/14 08:16 PM
Delete your messages.ini file, you probably have some stuff left from the previous attempt that messes up the $calc.

Your file is located in your mircdir, type
Quote:
//echo $mircdir
in the chat and you can find it, if you don't know where it is.
Posted By: Chazzy Re: anti timer - 10/05/14 08:27 PM
Ok. Checking now ...
Ths very much !!!
Posted By: Chazzy Re: anti timer - 10/05/14 08:34 PM
After i delete messages.ini the script made it again and write
[user]
ID=1
1=1399753742

After this , on the next msg from the user he give me again invalid format: $calc
And the script don't write in the messages.ini
Posted By: Wims Re: anti timer - 10/05/14 08:46 PM
Right, before asking the user about their mistakes, you should test the script and make sure it works, it doesn't grin
Posted By: Chazzy Re: anti timer - 10/05/14 09:08 PM
frown and how i can make it work ?
Posted By: Nillen Re: anti timer - 10/05/14 09:19 PM
I was unable to re-create the user's error with the exact script provided. Thus I assumed that the error was from the earlier version also using Messages.ini $nick ID.

https://www.youtube.com/watch?v=-MupAEYoTKU&feature=youtu.be
Script works fine for me.
Posted By: Wims Re: anti timer - 10/05/14 09:27 PM
What is the code that you are using?
That line, quoted from the last code shown in here is not going to work, the bold part is probably not what you meant to use, you're trying to check if a string with letters is superior than a number:

Quote:
if (%ID $+ .Difference == $calc(%ID - 1) $+ .Difference) && (%ID $+ .Difference > 30) echo 4 -a Match found by $nick $+ . The difference are both exactly $v1 $+ !


I watched the video, it doesn't show that the code is working, only that the INI file is populated, but that last if statement can't possibly true, it will never warn anything.
Posted By: Nillen Re: anti timer - 10/05/14 09:33 PM
You are very correct, my mistake. I definitely meant to make those to read the value from the ini file. However, this was not the error that the user presented.
Originally Posted By: Chazzy
After i delete messages.ini the script made it again and write
[user]
ID=1
1=1399753742

After this , on the next msg from the user he give me again invalid format: $calc
And the script don't write in the messages.ini
So there are 2 entirely different matters at hand right now.

Updated code that should use the ini file for value:
Code:
on *:text:*:#: { 
  var %ID $iif($readini(messages.ini,$nick,ID),$v1,$null)
  inc %ID
  writeini messages.ini $nick ID %ID
  writeini messages.ini $nick %ID $ctime 
  remini messages.ini $nick $calc(%ID - 4)
  remini messages.ini $nick $calc(%ID - 4) $+ .Difference
  var %difference $calc($readini(messages.ini,$nick,%ID) - $readini(messages.ini,$nick,$calc(%ID - 1)))
  writeini messages.ini $nick %ID $+ .Difference %difference
  if (%difference == $readini(messages.ini,$nick,$calc(%ID - 1) $+ .Difference)) && (%difference >= 30) echo 4 -a Match found by $nick $+ . The difference are both exactly $v1 $+ !
}


Edit: Tested successfully.

I don't know how to make it +-5 seconds however, if this is a requirement someone else will have to step in.

Edit2: Forgot to remove #nillens
Posted By: Chazzy Re: anti timer - 10/05/14 09:37 PM
I set script in a new irc client and the list ini is populated to... but no echo from script ...
Posted By: blessing Re: anti timer - 11/05/14 01:12 AM
try if this is what you want.
Code:
on *:TEXT:*:#:{
  tokenize 32 $readini(antitimer.txt,#,$nick) 
  var %1 $ctime, %2 $calc(%1 - $1), %3 $iif(%2 == $2,$calc($3 + 1),1)
  writeini antitimer.txt # $nick %1 %2 %3
  if %3 >= 3 { echo 4 -agt $nick was detected using timer in # ( $duration(%2) interval ) | beep }
}
Posted By: Chazzy Re: anti timer - 11/05/14 09:11 AM
and it is working very well laugh both script laugh
first script working ( for me ) only on clean irc ( no other script ) and you`r script , Blessing , is working on irc client i use laugh ths very very much !!!!
© mIRC Discussion Forums