mIRC Homepage
Posted By: devve Chanstats - 24/04/05 06:48 PM
Hi, i need a script that tells how many channels im in, in how many networks and how many queries ive got open.
Posted By: SladeKraven Re: Chanstats - 24/04/05 07:02 PM
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.
Posted By: devve Re: Chanstats - 24/04/05 07:30 PM
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
Posted By: SladeKraven Re: Chanstats - 24/04/05 08:23 PM
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)) { }
}
Posted By: FiberOPtics Re: Chanstats - 25/04/05 09:02 PM
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)
}
Posted By: devve Re: Chanstats - 26/04/05 03:00 PM
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...
Posted By: FiberOPtics Re: Chanstats - 26/04/05 05:26 PM
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
© mIRC Discussion Forums