mIRC Home    About    Download    Register    News    Help

Print Thread
channel numbers help....... please #175309 20/04/07 02:36 PM
Joined: Oct 2006
Posts: 20
G
ghettowboy Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Oct 2006
Posts: 20
howdy all,

i'm trying to be able to view channel number activity thru a dialog.. joins, parts , voice, de-voice, ect.... you get the idea. all i want is numbers. so when the dialog is open i'll see this activity as it happens..

this is an example of what i'm talking about:
Code:
dialog chan_stat  {
  title Stats
  size -1 -1 128 64
  option dbu
  box "User Stats", 16, 6 3 113 40
  text "&Ops:", 4, 10 14 11 8
  edit "", 1, 23 12 14 12, read
  text "&Voiced:", 5, 42 14 18 8
  edit "", 2, 62 12 14 12, read
  text "&Regular:", 6, 80 14 20 8
  edit "", 3, 102 12 14 12, read
  text "Total Number of Users:", 29, 13 30 59 8
  edit "", 30, 75 27 18 13, read
  button "&Done", 20, 45 48 37 12, ok
}
on *:dialog:chan_stat:init:*:{
  did -a $dname 30 $nick(%test.chan,0) 
  did -a $dname 1 $nick(%test.chan,0,o) 
  did -a $dname 2 $nick(%test.chan,0,v) 
  did -a $dname 3 $nick(%test.chan,0,r)
}
on *:OP:%test.chan:{
  did -ra chan_stat 1 $nick(%test.chan,0,o)
  did -ra chan_stat 2 $nick(%test.chan,0,v)
  did -ra chan_stat 3 $nick(%test.chan,0,r)
}

on *:DEOP:%test.chan:{
  did -ra chan_stat 1 $nick(%test.chan,0,o)
  did -ra chan_stat 2 $nick(%test.chan,0,v)
  did -ra chan_stat 3 $nick(%test.chan,0,r)
}

on *:voice:%test.chan:{
  did -ra chan_stat 2 $nick(%test.chan,0,v)
  did -ra chan_stat 3 $nick(%test.chan,0,r)
}

on *:devoice:%test.chan:{
  did -ra chan_stat 2 $nick(%test.chan,0,v)
  did -ra chan_stat 3 $nick(%test.chan,0,r)
}

on *:JOIN:%test.chan: {
  if ($nick != $me) {
    did -ra chan_stat 30 $nick(%test.chan,0)
    did -ra chan_stat 3 $nick(%test.chan,0,r)
  }
}

on *:PART:%test.chan:{
  did -ra chan_stat 1 $nick(%test.chan,0,o)
  did -ra chan_stat 2 $nick(%test.chan,0,v)
  did -ra chan_stat 3 $nick(%test.chan,0,r)
  did -ra chan_stat 30 $nick(%test.chan,0)
}

on *:KICK:%test.chan:{ 
  did -ra chan_stat 1 $nick(%test.chan,0,o)
  did -ra chan_stat 2 $nick(%test.chan,0,v)
  did -ra chan_stat 3 $nick(%test.chan,0,r)
  did -ra chan_stat 30 $nick(%test.chan,0)
}

on *:QUIT:{
  did -ra chan_stat 1 $nick(%test.chan,0,o)
  did -ra chan_stat 2 $nick(%test.chan,0,v)
  did -ra chan_stat 3 $nick(%test.chan,0,r)
  did -ra chan_stat 30 $nick(%test.chan,0)
}
 


for the tracking of opping and voicing an such.. it seems to work, although it probally could be done more efectively. but, the parts and quits i know for fact its not right.
so i'm asking for some pointers and or advise on this to get this working properly..

thanks in advance

Re: channel numbers help....... please [Re: ghettowboy] #175311 20/04/07 05:01 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
This will work. I put all of your /did commands into an alias just to reduce the size of your script. I know that OP/DEOP/etc don't need to fill all spaces, but it won't hurt. I have it set in the alias so that if the dialog isn't open, it won't do anything. If you'd rather have it open the dialog automatically, you can change RETURN to your DIALOG command.

Code:
dialog chan_stat  {
  title Stats
  size -1 -1 128 64
  option dbu
  box "User Stats", 16, 6 3 113 40
  text "&Ops:", 4, 10 14 11 8
  edit "", 1, 23 12 14 12, read
  text "&Voiced:", 5, 42 14 18 8
  edit "", 2, 62 12 14 12, read
  text "&Regular:", 6, 80 14 20 8
  edit "", 3, 102 12 14 12, read
  text "Total Number of Users:", 29, 13 30 59 8
  edit "", 30, 75 27 18 13, read
  button "&Done", 20, 45 48 37 12, ok
}
on *:dialog:chan_stat:init:*:{
  FillStats
}
on *:OP:%test.chan:{
  FillStats
}

on *:DEOP:%test.chan:{
  FillStats
}

on *:voice:%test.chan:{
  FillStats
}

on *:devoice:%test.chan:{
  FillStats
}

on *:JOIN:%test.chan: {
  FillStats
}

on *:PART:%test.chan:{
  FillStats
}

on *:KICK:%test.chan:{ 
  FillStats
}

on *:QUIT:{
  FillStats
}
 
alias FillStats {
  if (!$dialog(chan_stat)) { return }
  .timer 1 0 did -ra chan_stat 1 $!nick(%test.chan,0,o)
  .timer 1 0 did -ra chan_stat 2 $!nick(%test.chan,0,v)
  .timer 1 0 did -ra chan_stat 3 $!nick(%test.chan,0,r)
  .timer 1 0 did -ra chan_stat 30 $!nick(%test.chan,0)
}


Invision Support
#Invision on irc.irchighway.net
Re: channel numbers help....... please [Re: Riamus2] #175316 20/04/07 07:24 PM
Joined: Oct 2006
Posts: 20
G
ghettowboy Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Oct 2006
Posts: 20
that works very well Riamus2, thanks..... i noticed you also did this:
Code:
 
 .timer 1 0 did -ra chan_stat 1 [color:#FF0000]$![/color]nick(%test.chan,0,o)
 


whats the purpose of that... from what i saw in the help file
Quote:
This is similar to the line above except for the addition of the $! parameter. This refers to the text you just typed into the parameter box.


don't really understand that either.. hehe

Re: channel numbers help....... please [Re: ghettowboy] #175326 20/04/07 11:55 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Timers evaluate things when they are started rather than when the time is up.

When someone parts or quits, the event happens "before" the number of people in the channel changes. So you were getting the number of people in the channel just before the person left. The timer with no delay can be used to make it happen after the person leaves. Even with 0 delay, it still happens afterwards. However, because timers evaluate when they are called, it would still tell you the number of people at the time of the event rather than the number of people at the time the event finishes (i.e. the person leaves). The ! after the $ makes the timer *not* evaluate the identifier until the time the timer triggers.

Try these as examples to see:

//.timer 3 1 echo -a $time
//.timer 3 1 echo -a $!time

As you can see, the first one just repeats the $time that it was when the timer was started and the second one tells you the $time it is when the timer triggers.


Invision Support
#Invision on irc.irchighway.net
Re: channel numbers help....... please [Re: Riamus2] #175332 21/04/07 12:14 AM
Joined: Oct 2006
Posts: 20
G
ghettowboy Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Oct 2006
Posts: 20
ok, now i understand.... thanks Riamus2
that was a pretty good explaination too i might add.. smile

still needs more tweaking tho.... it appears that if i'm on another channel the on quit triggers and i get blank fields.. lol
probaly could be fixed with a if statement like :
if ($chan == %test.chan) { fillstats }

thats just off the top of my head... but anywho

thanks again



Re: channel numbers help....... please [Re: ghettowboy] #175352 21/04/07 01:08 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
There isn't a channel associated with on QUIT, so you can't use your IF statement in there. I'm not sure why it would give you blanks, though. As long as you are in your test channel, you should get numbers even if you're also in other channels. Obviously, if you're not in your test channel and you have the dialog open, it will give you blanks when someone quits because it cannot get the information from the test channel. If that's what you're doing (leaving the test channel), then you may want to have something along the lines of:

if ($me ison %test.chan) { FillStats }


Invision Support
#Invision on irc.irchighway.net
Re: channel numbers help....... please [Re: Riamus2] #175355 21/04/07 01:17 PM
Joined: Oct 2006
Posts: 20
G
ghettowboy Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Oct 2006
Posts: 20
well, i'm not leaving the %test.chan at all... just that if i'm in another channel and that windows is active, it would pick up the quit signals from the other channel and thats when i would get the blank spots..... untill something happend in the test channel.... thats what i was trying to say.. kinda like looking at both... but i only want it restricted to w/e happens in the test chan

Re: channel numbers help....... please [Re: ghettowboy] #175357 21/04/07 01:18 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
It shouldn't matter because it should be able to get the $nick(%test.chan,0) or whatever regardless of what window is active. I'll look at it later (leaving for work now).


Invision Support
#Invision on irc.irchighway.net