mIRC Homepage
Posted By: j_shutz parsing results of /DNS as a variable - 19/09/12 02:29 PM
Hi guys,

I am trying to write a script that does a /DNS lookup on an IP address, and I would like to set the result as a variable.

is this a RAW, or how would I parse the result as a variable,
so that when I do a look up I can /msg $chan %variable ?

I appreciate your help, I was unable to find the answer via google.


Thanks in advance
Posted By: Loki12583 Re: parsing results of /DNS as a variable - 19/09/12 03:46 PM
Usage: /msgdns google.com #mychan

Code:
alias msgdns {
  var %host = $1, %chan = $$2
  set -u5 %dns $+ %host %chan
  .dns %host
}

on *:dns:{
  var %chan = %dns [ $+ [ $dns(0).addr ] ]
  unset %dns [ $+ [ $dns(0).addr ] ]

  if (!%chan) { return }

  if ($dns(1)) {
    msg %chan Dns resolved $dns(1).addr to $dns(1).ip
  }
  else {
    msg %chan Dns unable to resolve address $dns(0).addr
  }
}
© mIRC Discussion Forums