mIRC Homepage
Posted By: Jesper ON DNS - 03/05/03 02:53 PM
How do I get mIRC to set a %variable when I type /dns blah-blah

on *:DNS: { var %dnsname (what to have here ?) }
$2, $DNSIP(N) nothing seem to work frown

The script should look like this:
on *:DNS: { 
  set %dnsname (missing variable)
  if ((!$iaddress) && (!$naddress) && (!$raddress)) { echo -a cant resolve %dnsname }
  else {
    echo -a -Ă— Displaying DNS-Info for: %dnsname
    if $iaddress { echo -a IP Address $iaddress
    if $naddress { echo -a Address $naddress } 
    if $raddress { echo -a Address $raddress } 

all works cept the %variable isnt set, and I ran out of ideas frown

Posted By: milk Re: ON DNS - 03/05/03 04:13 PM
See help on mIRC, topic: On DNS.. i think you'll find your answer there.

The $dns(N) identifier
This identifier can be used only in the on DNS event, and returns the address that was resolved and any associated IP addresses.

Posted By: Nimue Re: ON DNS - 03/05/03 04:59 PM
Use Search. There is a lot of DNS scripts posted.. smile
Posted By: Jesper Re: ON DNS - 03/05/03 05:09 PM
tra la la la youre missing the point... Im not looking for "what is resolved" im looking to set an variable of my input (what I dns)

/dns Jesper (%var Jesper)
/dns www.mirc.com (%var www.mirc.com)
/dns jibberish (%var jibberish)
/dns "nonexistant user/host" (%var my input)

As I said the rest of the script works, and $DNSIP(N) is useless unless something is resolved ( what I need is a %var before it evens starts to resolve) wink
I do read mirc's help file, more than a preacher reads his bible :P but in many cases it does not carry enuff of examples / lacks the description of what a command can or cant do. wink

And I did use search here, but I didnt find any usefull results.
Posted By: Nimue Re: ON DNS - 03/05/03 05:31 PM
Like I said use Search, there are a lot posted, from them you could have found your answer. laugh

on *:dns: {
  if !$raddress {
    if $dns(0).nick || $iaddress || $dns(0).addr { var %a = $ifmatch }
    if $dns(0).nick {
      if $iaddress || $dns(0).addr { var %b = ( $+ $ifmatch $+ ) }
      else var %b = (No such nick)
    echo $colour(h) -ta DNS lookup on %a failed. %b
  echo $colour(h) -ta DNS lookup on $iif($dns(1).nick,$ifmatch,$dns(1)) successful.
  echo $colour(h) -ta Named address: $dns(1).addr
  var %i = 1 {
    while $dns(%i) {
      echo $colour(h) -ta IP address: $dns(%i).ip
      inc %i
Posted By: Jesper Re: ON DNS - 03/05/03 07:06 PM
many thanks smile
Posted By: Nimue Re: ON DNS - 03/05/03 07:24 PM
NP grin
© mIRC Discussion Forums