mIRC Home    About    Download    Register    News    Help

Print Thread
#225036 24/08/10 10:33 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
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,.) }
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
I've got to go eat now, but first of all, have you looked at $comchan?

5618 #225038 24/08/10 01:23 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
$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,.) }
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
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.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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)



Link Copied to Clipboard