mIRC Homepage
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
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.
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
Just replace the 2 occurences of "autohi" with some other name (different for every script).
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
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)
    }
  }
}

mmm ok

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

eg
Code:
hi* - hello!

that will match
Code:
hi!
hi,

etc
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.
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
Change
Code:
if $read(Hi.txt,w,$+($1-,*)) {
to
Code:
if $read(Hi.txt,w,$1-) {

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
Just use notepad, and remember to save the file to your mIRC directory.
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?
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)

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) ?
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.
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
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
}
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
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?
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)
There's no reason to have a ! before $gettok in there.
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
© mIRC Discussion Forums