I want my bot to report the output of /dns hostname when .dns hostname is posted in the chan...so i used this:on
*:TEXT:.dns *:*:{
/set %botdns $dns($2)
.notice $nick %botdns
but it always comes back as 0 for some reason
You can't use $dns like that, you have to do a /dns and then use on DNS to get what it resolved to.
umm how would i go about doing that?
collective's right, you can't do what you're attempting with mirc's internal commands. however, i believe there is a dll at ms.org that will retrieve/resolve dns hosts in the manner you're looking for.
edit:
raddip.dll
ON *:TEXT:.dns *:*:{
.dns $2
.set %bot_dns_nick $nick
.enable bot_dns
}
#bot_dns off
ON *:DNS:{
.notice %bot_dns_nick $dns(1)
.unset %bot_dns_nick
.disable bot_dns
}
#bot_dns end
this doesnt work, or at least not how i thought it would...
all i need to happen is when someone types .dns hostname in a chan for the bot to .notice them the ip it resolves to.
Err you're right, this works exactly how you want it to:
ON *:TEXT:.dns *:*:{
.dns $2
.set %bot_dns_nick $nick
.enable #bot_dns
}
#bot_dns off
ON *:DNS:{
if (!$dns(0)) {
.notice %bot_dns_nick Unable to resolve $iif($iaddress,$iaddress,$dns(0).addr)
}
else {
.notice %bot_dns_nick Resolved $dns(1) to $iif($dns(1) == $dns(1).ip,$dns(1).addr,$dns(1).ip)
}
.unset %bot_dns_nick
.disable #bot_dns
halt
}
#bot_dns end