mIRC Homepage
Posted By: Scorpwanna if $nick is on $server - 10/06/07 12:00 AM
I'm tinkering around with some script ideas and I'm trying to think of the easiest method for determining if a $nick is on a $server. I've looked through the $identifiers list and can't seem to find one for what I want.

Other than alternative scripting methods is there a short 1 line bit of code i could use other than adding them to the notify list and using $notify.
Posted By: SladeKraven Re: if $nick is on $server - 10/06/07 12:25 AM
Try this code and using /ison.

Code:
Raw 303:*: {
  var %ison = $gettok($1-,2-,32)
  if (!%ison) echo -a User not online.
  else echo -a Users online: %ison
  halt
}


/ison SladeKraven Scorpwanna Khaled etc.
Posted By: RoCk Re: if $nick is on $server - 10/06/07 12:46 AM
Using this /sleep alias by Online you could make an identifier...

Usage: $ison(<nick>)
Example: //echo -a $ison(Scorpwanna)

Code:
alias ison {
  if (!$isid) ison $1-
  else {
    set -eu5 %isonid $1
    ison $1
    sleep 1000
    return %isonid
  }
}
alias sleep {
  var %a = $ticks $+ .wsf
  write %a <job id="js"><script language="jscript">WScript.Sleep( $+ $$1 $+ );</script></job>
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,%a,uint,0,bool,true) }
  .remove %a
}
raw 303:*: {
  if (%isonid == $null) return
  set %isonid $iif($istok($2-,%ison,32),$true,$false)
  halt
}
Posted By: maroon Re: if $nick is on $server - 10/06/07 01:36 AM
Unless /ison has a way of specifying to look at 1 $server, it looks to me as if the other replies are checking to see if the nick is on the $network, not on the $server. To check if they're on a particular server, you could do a /whois on them and check the reply to raw 312. Alternately, you can build a list of nicks using either:

/who +cs #channel_name servername.net

or

/who +s servername.net

and checking the return on raw 352.

edit: oops, nevermind, i finally see the $server name in the /ison raw reply.
© mIRC Discussion Forums