mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2015
Posts: 18
X
Pikka bird
OP Offline
Pikka bird
X
Joined: Apr 2015
Posts: 18
Hi, I am creating an auto-responder, and I ran into an issue. When I querry somebody first, and they respond, it still sends them an auto-response. How could I check if I already querried somebody? Thanks!

Code:
if (%autoreply. [ $+ [ $nick ] ]) {
  return set -u1200 %autoreply. $+ $nick
}

on *:OPEN:?:*: {
  var %exc = $false
  var %c = 0
  while (%c < $lines(C:\Users\Allen\AppData\Roaming\mIRC\exc.txt)) {
    inc %c
    if ($nick == $read(exc.txt, n, %c)) {
      %exc = $true
      /break
    }
  }
  if (%exc == $false) {
    if (!$away) {
      /msg $nick Hello $nick $+ , I should be with you shortly. Feel free to leave a message. Note I have $query(0) queries open and have been idle for $duration($idle) $+ .
    } 
    elseif ($away) {
      /msg $nick Hello $nick $+ , I am currently away ( $+ $awaymsg $+ ). Feel free to leave a message. Note that I have $query(0) queries open and have been away for $duration($awaytime) $+ .
    }
  }
}

alias rep {
  var %target = $$1
  /msg %target Hello %target $+ . How may I help you?
}

alias addexc {
  if (!$exists(C:\Users\Allen\AppData\Roaming\mIRC\exc.txt)) {
    /echo -c kick [ERROR] exc.txt Not Defined. 
  }
  else {
    var %v = 0
    var %w = 0
    while (%v < $lines(C:\Users\Allen\AppData\Roaming\mIRC\exc.txt)) {
      inc %v
      if ($$1 != $read(exc.txt, n, %v)) {
        inc %w
      }
    }
    if (%w >= $lines(C:\Users\Allen\AppData\Roaming\mIRC\exc.txt)) {
      /write exc.txt $$1
      /echo -c notify [AUTO-RESP] Nick $$1 Declared an Exception
    }
    else {
      /echo -c kick [ERROR] Nick $$1 Already Declared Exception
    }
  }
}
alias delexc {
  if (!$exists(C:\Users\Allen\AppData\Roaming\mIRC\exc.txt)) {
    /echo -c kick [ERROR] exc.txt Not Defined.
  }
  else {
    var %g = 0
    var %e = $false
    while (%g < $lines(C:\Users\Allen\AppData\Roaming\mIRC\exc.txt)) {
      inc %g
      if ($$1 == $read(exc.txt, n, %g)) {
        %e = $true
        /break
      }
    }
    if (%e == $true) {
      ;/echo -c kick $readn
      ;/echo -c kick $read(exc.txt, n, $readn)
      /write $+(-dl,$readn) exc.txt
      /echo -c notify [AUTO-RESP] Nick $$1 No Longer Declared an Exception
    }
    else {
      /echo -c kick [ERROR] Nick $$1 Not Already Declared Exception
    }
  }
}
alias listexc {
  var %a = [AUTO-RESP] $chr(32)
  var %i = 0
  while (%i < $lines(C:\Users\Allen\AppData\Roaming\mIRC\exc.txt)) {
    inc %i
    var %a = %a $+ $read(exc.txt, n, %i) $+ , $chr(32)
  }
  /echo -c notify %a 
}


Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Check if you have a query window open with them.

if ($query($nick)) { return }


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Apr 2015
Posts: 18
X
Pikka bird
OP Offline
Pikka bird
X
Joined: Apr 2015
Posts: 18
But when you initially msg them, a query window does not pop up. Its when they respond that a query is opened.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Quote:
... and they respond, it still sends them an auto-response.


Since they respond, a query window opens, and your bot shouldn't send a reply. Or if I'm wrong, see if using /updatenl helps. Otherwise just keep track of who your auto-responder messages with variables that self expire.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard