mIRC Homepage

make autoreply to work only once or twice

Posted By: nataliad

make autoreply to work only once or twice - 01/04/07 02:37 PM

hello

I have this script

on *:text:hi:?: .timer 1 3 msg $nick hello!

but I want to make it not to work for the same nick for more than 1-2 times

I mean if someone pastes hi for multiple times, I dont want to reply all the times, just the first

is it possible?

thanks
Posted By: Riamus2

Re: make autoreply to work only once or twice - 01/04/07 02:45 PM

Code:
on *:text:hi:?: {
  inc -u600 %autohi. $+ $nick
  if ($($+(%,autohi.,$nick),2) < 3) { .timer 1 3 msg $nick hello! }
}


That will allow it to reply only 2 times to the word "hi" from the same nick within 10 minutes. Note that the 10 minute timer restarts if the nick says "hi" again. So if someone says "hi" every 5 minutes for an hour, you'd only auto-reply 2 times to that person. If someone says "hi" twice, then says "hi" again 15 minutes after the last "hi" by that person, then you'll auto-reply again.

I'm not sure I explained that well, so if you don't understand what I mean, let me know.
Posted By: nataliad

Re: make autoreply to work only once or twice - 22/04/07 11:28 PM

thanks

what if I have many such scripts?

I will just add to each of them this:

Code:
inc -u600 %autohi. $+ $nick | if ($($+(%,autohi.,$nick),2) < 3)


or I need anything more?

thanks
Posted By: Riamus2

Re: make autoreply to work only once or twice - 23/04/07 01:15 AM

Just replace the 2 occurences of "autohi" with some other name (different for every script).
Posted By: nataliad

Re: make autoreply to work only once or twice - 24/04/07 10:16 PM

mmm

is there a way to make it all one script?

and make a list like:

Code:
hi - hello!
how are you? - fine, thanks!
etc


the script will recognize everytime text of the left list is mentioned and it will respond the appropriate of the right list
Posted By: RusselB

Re: make autoreply to work only once or twice - 25/04/07 12:15 AM

Conditional that you can guarantee that the - is used to separate the two "sides", and only in that location, then yes it can.
Code:
on *:text:*:?: {
  if $read(Hi.txt,w,$+($1-,*)) {
    inc -u600 %autohi. $+ $nick
    if ($($+(%,autohi.,$nick),2) < 3) {
      .timer 1 3 msg $nick !$gettok($read(Hi.txt,$readn),-1,45)
    }
  }
}

Posted By: nataliad

Re: make autoreply to work only once or twice - 25/04/07 12:52 AM

mmm ok

but will it support wildcards/regex in the hi.txt list?

eg
Code:
hi* - hello!

that will match
Code:
hi!
hi,

etc
Posted By: RusselB

Re: make autoreply to work only once or twice - 25/04/07 02:07 AM

The search uses a wildcard match, so that it looks for the text that is entered followed by any other text.

The * for the wildcard match isn't required, as I have it included in the code.
Posted By: nataliad

Re: make autoreply to work only once or twice - 25/04/07 03:54 PM

mmm

I want the script not to add wildcards by its own

I want to determine on my own the appropriate wildcards

eg

Code:
hi
* hi*
hi?
* hi! *
etc
Posted By: RusselB

Re: make autoreply to work only once or twice - 25/04/07 06:05 PM

Change
Code:
if $read(Hi.txt,w,$+($1-,*)) {
to
Code:
if $read(Hi.txt,w,$1-) {

Posted By: nataliad

Re: make autoreply to work only once or twice - 25/04/07 09:28 PM

thanks

how to I write in the Hi.txt this:

hi! - hello! <newline> How are you?

in other words, to respond two sentences instead of one

thanks
Posted By: RusselB

Re: make autoreply to work only once or twice - 25/04/07 10:23 PM

Just use notepad, and remember to save the file to your mIRC directory.
Posted By: nataliad

Re: make autoreply to work only once or twice - 25/04/07 10:59 PM

ummm

I think I wasnt clear

I mean to respond to:

Code:
hi


with:

Code:
hello!
how are you?


how will I write this in the Hi.txt file?
Posted By: RusselB

Re: make autoreply to work only once or twice - 25/04/07 11:44 PM

Ooops..sorry..I think you would enter it in the text file like this
Quote:
hi-hello! | how are you?


also, add the p switch to the w in the $read line(s)

Posted By: nataliad

Re: make autoreply to work only once or twice - 26/04/07 11:39 PM

thanks!

Originally Posted By: RusselB

also, add the p switch to the w in the $read line(s)


mm can you tell me how the script will be please?

1) how can I have the text of Hi.txt inside the remote.ini?
2) how can I make it not to msg the same ip for more than 2 times (while now it wont msg the same nick for two times) ?
Posted By: RusselB

Re: make autoreply to work only once or twice - 27/04/07 01:31 AM

1) You can't. They are two different files.
2) Unless you have IRCops status, you can't be guaranteed of being able to get a person's IP address, so I don't recommend this.
3) Please read the New to the forums sticky, specifically the section that says
Quote:
e) Realize YOU have to do work to solve the problem you are having. People here can offer ideas/suggestions/input and maybe even solve things entirely, but it's up to YOU to do the work.


Taking what we've already given you, and combining it with some reading of the help file, should be more than sufficient to get you the code.
Posted By: nataliad

Re: make autoreply to work only once or twice - 27/04/07 01:38 AM

thanks
the two read lines are these:

if $read(Hi.txt,w,$+($1-,*)) {
.timer 1 3 msg $nick !$gettok($read(Hi.txt,$readn),-1,45)

but how do I add the p switch?

as for the ip, I know the ips, so can you tell me the script with ips please

thank you
Posted By: BritishGent

Re: make autoreply to work only once or twice - 28/04/07 03:15 PM

try this, it might work smile

[code]
on 1:text:hi*:#: {
if ($2 == all) {
msg $chan <all> hi $nick
msg $chan <all> $nick how are you?
halt
}
Posted By: nataliad

Re: make autoreply to work only once or twice - 29/04/07 02:14 AM

msg $chan?

what are you talking about?
Posted By: hixxy

Re: make autoreply to work only once or twice - 29/04/07 11:29 AM

Originally Posted By: nataliad
but how do I add the p switch?


You read the help file like Russel suggested. Type /help $read
Posted By: nataliad

Re: make autoreply to work only once or twice - 29/04/07 01:52 PM

I think this is the code that will work for ips (it wont msg two times the same ip)

Code:
on *:text:*:?: {
  if $read(Hi.txt,w,$1-) {
    inc -u600 %autohi. $+ $address($nick,4)
    if ($($+(%,autohi.,$address($nick,4)),2) < 3) {
      .timer 1 3 msg $nick !$gettok($read(Hi.txt,$readn),-1,45)
    }
  }
}


any corrections?
Posted By: nataliad

Re: make autoreply to work only once or twice - 29/04/07 09:31 PM

Code:
on *:text:*:?: {
  if $read(hi.txt,w,$1-) {
    inc -u600 %autohi. $+ $address($nick,4)
    if ($($+(%,autohi.,$address($nick,4)),2) < 3) {
      .timer 1 3 msg $nick !$gettok($read(hi.txt,$readn),-1,45)
    }
  }
}


this script doesnt work

it doesnt say the proper reply

whats wrong? frown

PS:

I basically want to match specific queries with specific automatic replies, but to work only once in 600 secs for the same ip/host (*!*@anything)

the specific queries and their automatic replies should be stored in hi.txt in this format:
specificquery - reply
(supporting wildcards)
Posted By: Riamus2

Re: make autoreply to work only once or twice - 30/04/07 06:08 PM

There's no reason to have a ! before $gettok in there.
Posted By: nataliad

Re: make autoreply to work only once or twice - 30/04/07 11:09 PM

thanks

I think this works better

Code:
on *:text:*:?:{
  if ($fprot) { return }
  if ($1- iswm hi *) { msg $nick hello $nick | fprot 100 }
  elseif ($1- iswm bye *) { msg $nick goodbye $nick | fprot 100 }
}
alias -l fprot {
  if ($isid) { return $hget(fprot,$site) }
  elseif ($1 isnum) { hadd -mz fprot $site $1 }
}


and it doesnt consumes resources trying to read the text file

however there is a problem:

it stops replying to the same ip if it has replied once to ANY of the hi,bye,etc to this ip

I want to make it stop replying to the same ip if it has replied once to the SAME hi,bye,etc

I mean if someone tells me hi, and then (before 100 secs expire) bye, I want to reply to both

I dont want to reply to the second time he says hi inside 100 seconds, not to any other query he send inside 100 secs

thanks
© 2020 mIRC Discussion Forums