First, all of your ( $did
= # ) should use
==, since
= means "is assigned the value" rather than "is equal to."
Also, only the first line should be
If (condition); each line thereafter should be
ElseIf (condition). This causes control to drop to out of the event once a $did has been matched and not have to keep on comparing $did to another number all the way down.
Then you will have to redirect all the raw numeric events to their query window yourself, either by setting a variable to check before you whois them, by enabling a #group, or by deciding that you always want their whois information to go to their query window, if there's one open. (The code that follows combines the last two ideas, in case you decide that you always want their whois info in their query window, if available, perhaps for logging reasons. In such a case, you need only remove the 2 group lines, the disabling command in the 318 event and the enabling command in the on DIALOG event.) This is a design decision you must make.
Incidentally, if this dialog is being triggered in a query window, your
($did == 4) makes no sense. You're already
in the query window with them, and the query window is not only open, but you have launched this dialog
from that query window.
In this example script, I have included a #group so that the additional script code only runs when you have doing this /whois from the dialog control. It turns itself on and off through the script.
on *:DIALOG:whois_de:sclick:*:{
IF ($did == 2) {
.ENABLE #WHOIS_DE
.WHOIS $active $active
}
ELSEIF ($did == 3) .UWHO $active
ELSEIF ($did == 4) .QUERY $active
ELSEIF ($did == 8) .CTCP $active PING
ELSEIF ($did == 9) .CTCP $active VERSION
ELSEIF ($did == 10) .CTCP $active TIME
ELSEIF ($did == 11) .CTCP $active CLIENTINFO
ELSEIF ($did == 12) .CTCP $active USERINFO
ELSEIF ($did == 13) .CTCP $active FINGER
ELSEIF ($did == 15) .DCC SEND $active
ELSEIF ($did == 16) .DCC CHAT $active
}
#WHOIS_DE off
; User info
raw 311:*:{
IF ($query($2)) {
ECHO $color(whois) -ti2 $2 $2 is $+($3,@,$4-)
HALT
}
}
; Channels list
raw 319:*:{
IF ($query($2)) {
ECHO $color(whois) -ti2 $2 $2 on $3-
HALT
}
}
; Server info
raw 312:*:{
IF ($query($2)) {
ECHO $color(whois) -ti2 $2 $2 using $3-
HALT
}
}
; (DALnet/bahamut) has identified for nick (+r)
raw 307:*:{
IF ($query($2)) {
ECHO $color(whois) -ti2 $2 $2-
HALT
}
}
; IRC Operator info
raw 313:*:{
IF ($query($2)) {
ECHO $color(whois) -ti2 $2 $2-
HALT
}
}
; Away message
raw 301:*:{
IF ($query($2)) {
ECHO $color(whoIs) -ti2 $2 $2 is away: $3-
HALT
}
}
; Idle duration and Sign-On time
raw 317:*:{
IF ($query($2)) {
ECHO $color(whoIs) -ti2 $2 $2 has been idle $duration($3) $+ , signed on $asctime($4,ddd mmm d H:nn:ss)
HALT
}
}
; End of /WHOIS list.
raw 318:*:{
IF ($query($2)) {
ECHO $color(whoIs) -ti2 $2 $2-
.DISABLE #WHOIS_DE
HALT
}
}
#WHOIS_DE end
Normally, I prefer to use all lower case for everything in scripts except where I want something to stand out or in a displayed message which should have caps in it.
mIRC ignores case unless you specifically tell it not to. Judicious use of caps can make things stand out better, such as in the #group name in the preceeding example; overuse of caps lessens their impact, making you, in effect, caps-blind. In this particular case, I have capitalized all the commands to make the IF-ELSEIF-ELSE structures show up better, as well as pointing out the logic in each of the raw events.