mIRC Homepage
Posted By: sparta track user/channel - 24/08/10 10:33 AM
I trying to track users that are on the same channel as me. And i made this code
Code:
alias tchan {
  var %x = $chan(0)
  var %y = 1
  while (%y <= %x) {
    set %tmp.track $addtok($chan(%y),44,1) $chan(%y)
    inc %y
  }
}
alias track {
  if ($1 != $null) {
    if ($1 isin %tmp.track) && ($1 != $me) { echo -a $1 ison #channel_user_is_on | return }
  }
}

Now to my question.
How can i

1: get the channel the user are on from the var %tmp.track (i know i can use var = instead of set)
2: also include other networks if im connected to more then one
Posted By: 5618 Re: track user/channel - 24/08/10 10:49 AM
I've got to go eat now, but first of all, have you looked at $comchan?
Posted By: sparta Re: track user/channel - 24/08/10 01:23 PM
$comchan($1,1) solved one of the problem. smile didnt think of that one.

Posted By: 5618 Re: track user/channel - 24/08/10 01:40 PM
Regarding all networks, you should just execute your script on all active connections.
You can do this either with /scon -at1 alias (but your script may not like this, depending on how it's constructed) or you should cycle active connection, e.g.:
Code:
var %n = 1
while ($scon(%n)) {
  if ($scon(%n).server) {
    scon %n
    your script
  }
  inc %n
}

$scon(%n).server will return $null if you are not connected, so not execute your script.
Posted By: RusselB Re: track user/channel - 24/08/10 09:49 PM
If the purpose of
Code:
set %tmp.track $addtok($chan(%y),44,1) $chan(%y)
is to keep a list of channels in the variable, then your code, while it might work, is not the best.

I recommend you change it to
Code:
set %tmp.track $addtok(%tmp.track,$chan(%y),44)

© mIRC Discussion Forums