mIRC Home    About    Download    Register    News    Help

Print Thread
#118343 24/04/05 06:48 PM
Joined: Sep 2004
Posts: 10
D
devve Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Sep 2004
Posts: 10
Hi, i need a script that tells how many channels im in, in how many networks and how many queries ive got open.

#118344 24/04/05 07:02 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
alias stats {
  echo -a You are on $iif($chan(0) < 1,no,$chan(0)) channels.
  echo -a You have $iif($query(0) < 1,no,$query(0)) query windows open.
  var %x = $scon(0)
  while (%x) {
    if ($scon(%x).status = connected) { echo -a You have $scon(0) Status Windows open $scon(%x) of which you are connected to. | halt }
    dec %x
  }
}


You are on no channels.
You have no query windows open.
You have 3 Status Windows open 2 of which you are connected to.

Last edited by SladeKraven; 24/04/05 07:08 PM.
#118345 24/04/05 07:30 PM
Joined: Sep 2004
Posts: 10
D
devve Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Sep 2004
Posts: 10
echo -a You are on $iif($chan(0) < 1,no,$chan(0)) channels.
echo -a You have $iif($query(0) < 1,no,$query(0)) query windows open.
Those lines only wrks on the active network i do the echo on, so it doesnt count the other networks

#118346 24/04/05 08:23 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I'm not sure if this will work, but the only thing that would stop it from working is if you hold shift down and left click on a multi server. Or right clicking on it to close. To stop that from happening just simply close the channels before closing a server. The query one should work fine too although it will only write to the file when you receive a Private Message not when you open it by typing /query.

I'll keep working on a code that will work for Quit/Disconnect etc. I'm sure there's a cleaner wayto doit without using files and someone will mostly add their 2 cents worth but for now here's the code..

Code:
alias stats {
  echo -a You are on $iif($lines(chanstats.txt) &lt; 1,no,$v1) channels
  echo -a You have $iif($lines(querystats.txt) &lt; 1,no,$v1) query windows
  var %x = $scon(0)
  while (%x) {
    if ($scon(%x).status == connected) { echo -a You have $scon(0) Status Windows open $scon(%x) of which you are connected to. | halt }
    dec %x
  }
}

on 1:OPEN:?:*: {
  if (!$read(querystats.txt,w,$nick)) write querystats.txt $nick
}

On *:Close:?:  {
  if ($read(querytats.txt,w,$target)) { write -dw $+(",$target,") querystats.txt }
}

On me:*:Join:#: {
  if (!$read(chanstats.txt,w,$chan)) write chanstats.txt $chan
}

On me:*:Part:#: {
  if ($read(chanstats.txt,w,$chan)) { }
}

#118347 25/04/05 09:02 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That's a very weird way of going at it. Don't see the purpose of the on part event since you don't make it do anything.

Didn't know how to name the alias but here goes:

Code:
alias chanquerynet {
  var %a = 0, %b = 0
  scon -a if ($query(0)) inc $(%a |,) if ($chan(0)) inc % $+ b
  echo -a Total queries: %a ** Total chans: %b ** Total server windows: $scon(0)
}


Gone.
#118348 26/04/05 03:00 PM
Joined: Sep 2004
Posts: 10
D
devve Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Sep 2004
Posts: 10
Quote:
That's a very weird way of going at it. Don't see the purpose of the on part event since you don't make it do anything.

Didn't know how to name the alias but here goes:

Code:
alias chanquerynet {
  var %a = 0, %b = 0
  scon -a if ($query(0)) inc $(%a |,) if ($chan(0)) inc % $+ b
  echo -a Total queries: %a ** Total chans: %b ** Total server windows: $scon(0)
}


On totalchans it just give me same number as totalservers im on...

#118349 26/04/05 05:26 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Woops lol, I actually forgot to add the $v1 part with each inc.

So final code:

Code:
alias chanquerynet {
  var %a = 0, %b = 0
  scon -a if ($query(0)) inc $(%a $v1 |,) if ($chan(0)) inc $(%b $v1,)
  echo -a Total queries: %a ** Total chans: %b ** Total server windows: $scon(0)
}

If you're on mIRC prior to 6.16 then you'll have to change $v1 to $ifmatch.

Greets


Gone.

Link Copied to Clipboard