mIRC Home    About    Download    Register    News    Help

Print Thread
if $nick is on $server #178403 10/06/07 12:00 AM
Joined: Sep 2003
Posts: 261
S
Scorpwanna Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
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.


We don't just write the scripts, we put them to the test! (ScriptBusters)
Re: if $nick is on $server [Re: Scorpwanna] #178405 10/06/07 12:25 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
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.

Re: if $nick is on $server [Re: Scorpwanna] #178406 10/06/07 12:46 AM
Joined: Dec 2002
Posts: 2,025
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,025
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
}

Re: if $nick is on $server [Re: Scorpwanna] #178408 10/06/07 01:36 AM
Joined: Jan 2004
Posts: 1,637
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,637
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.

Last edited by maroon; 10/06/07 01:50 AM.