mIRC Home    About    Download    Register    News    Help

Topic Options
#225036 - 24/08/10 11:33 AM track user/channel
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
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
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#225037 - 24/08/10 11:49 AM Re: track user/channel [Re: sparta]
5618 Offline
Hoopy frood

Registered: 18/06/07
Posts: 933
I've got to go eat now, but first of all, have you looked at $comchan?

Top
#225038 - 24/08/10 02:23 PM Re: track user/channel [Re: 5618]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
$comchan($1,1) solved one of the problem. smile didnt think of that one.

_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#225039 - 24/08/10 02:40 PM Re: track user/channel [Re: sparta]
5618 Offline
Hoopy frood

Registered: 18/06/07
Posts: 933
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.

Top
#225064 - 24/08/10 10:49 PM Re: track user/channel [Re: sparta]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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)


Top