mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 21
S
sCHuTt Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2004
Posts: 21
A'ight,

my problem: The thing i been fiddling on is like this. /lusers shows me:

There are 6 users and 69 invisible on 4 servers
12 operator(s) online
15 channels formed
I have 58 clients and 3 servers
-
Current Local Users: 58 Max: 69
Current Global Users: 75 Max: 80


And I've tried to take each number an set it as a %, then /write it in a .csv file so i can make a nice graph of hourly users an channels.

Pretty desperate as I can't even figure out the friggin basics of this...

Anyone have an idea?

- sChutt

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Can you give me an idea of what your columns and rows in your excel file should look like, and what stats you want exactly from the lusers, and what should be portrayed as a percentage against what number.

If you give me a detailed representation of what the columns/rows should look like, then I can make some code for you that will deliver you a graph that you can drawpic inside an mIRC picture window, or that you can load inside any window with /background.

Be detailed, or I won't bother.

Anyway, you can start out with this:

Code:
#lusers on
on *:snotice:*:{
  if ($network == efnet) && (& clients have connected since * iswm $1-) echo -ac info $1 $ctime($6-)
  elseif ($network == undernet) && (highest connection count: * iswm $1-) echo -ac info $4 $remove($5,$chr(40))
}

raw 250:*: echo -ac info $5 $remove($6,$chr(40))
raw 251:*: echo -ac info $4 $7 $10
raw 252:*: echo -ac info $2
raw 253:*: echo -ac info $2
raw 254:*: echo -ac info $2 
raw 255:*: echo -ac info $4 $7
raw 265:*: echo -ac info $5 $7
raw 266:*: echo -ac info $5 $7
#lusers end


I put the echo's there without halting the default text, so that you can see what each $N parameter stands for. It might not be the complete list, but it got everything on Dalnet, Undernet, Efnet, and Rizon.

EDIT: I'm going home now, so I can only reply tomorrow.


Gone.
Joined: Aug 2004
Posts: 21
S
sCHuTt Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2004
Posts: 21
My bad, by % i meant variable.
The plan was to run a timer that ran every hour, an added a line in a file. Something like shown here http://irc.netsplit.de/networks/top.var but all items in one, for one network only. The format I was trying to get was something like:

date; hour; channels; local_users; max_local_users; global users; max_global_users; number_of_channels

Given a list of these, I could make Excel draw a nice graph of this over time. If your code can draw something like that in mIRC itself, that'd be even better. Tia m8.

- sChutt

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I asked you to be as specific as possible.

What do you mean with "all items in one"? Should all the different stats be included in 1 graph, say each property has a column, with a certain height, and the height will be adjusted every hour, when the value of the property changes?

Should the graph be reset when the 24hour time has been reached?

So the column should show hours (from 0 to 24), and the x-line should show the different stats like: channels, users, servers etc?

Where exactly do you want this graph to be shown btw? Should it be drawn in mIRC in a picture window?

Note that what you are asking for is quite excessive, and I may not have the time for it, as I have a C++ assignment due wednesday that I haven't even started on... The less elaborative/precise you are in your descriptions, the less I'm inclined to spend time on this rather than on my project.

Edit: Is it something like this you want?



Gone.
Joined: Aug 2004
Posts: 21
S
sCHuTt Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2004
Posts: 21
I'm sorry for not being as complete as I should in my explanations.

That picture shows users an channels right? Well i'd like a graph in that manner for local_users; max_local_users; global users; max_global_users; number_of_channels.

I thought all I needed was a text file with all these values added every hour an afterwards import it all in Excel for a graph.

The X-axis would show timeline an Y-axis would show values for each property: local_users; max_local_users; global users; max_global_users; number_of_channels.

- sChutt

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Ok, time for some feedback.

I created code that uses COM to communicate with Excel, and can let you create a graph from a .csv file. I won't show you the code yet, as I'm going to add some more stuff to it, but when it's finished, it'll be fully customizable. Here's a screenshot of what it looks so so far:



Note that the lines on the graph are just data I've whipped together real quickly, they are not really Dalnet stats.

Note that every single color/font/size/position etc. can be formatted easily with some custom aliases. Same for gridlines, type of lines, colors, thickness, position etc. The charttype is also optional, supporting anything Excel supports. So you can easily create a pie chart with the same command, just by changing a number. The color/linetype/thickness etc for the datalines can be chosen easily.

One thing I notice when checking //lusers on Dalnet, is that the number of channels is more or less the same as the amount of local users. So it will become somewhat hard to distinguish between those two stats. Furthermore, on dalnet the Max Gusers/Lusers are far higher from the regular Gusers/lusers, creating somewhoat of a "stupid" graph, with 2 straight horizontal lines on top. I would suggest to forget about these max stats, and only to focus on the current amount of lusers/gusers, so that the units on the y-axis aren't too stretched apart.

Anyway, I would like to give you the code as it's almost finished, but I must focus on my C++ project now, so I'll go back to this code on thursday. Right now, when I issue /chart, it will read a csv file, create a chart, and save it as chart.jpg, which you then can use in mIRC. All the Excel stuff is hidden.

Here's a little excerpt from the code as a little teaser (It's not usable as it's only part of the code):

Code:
 ; retrieving objects to x and y axis
  %t = $com(excel.chart,axes,1,uint,1,dispatch* x-axis) 
  %t = $com(excel.chart,axes,1,uint,2,dispatch* y-axis) 
 [color:red]  [/color] 
  ; set axes colors
  setborder x-axis color $rgb(255,0,0)
  setborder y-axis color $rgb(255,0,0)
 [color:red]  [/color] 
  ; show gridlines (true) or not (false)
  setgridlines x-axis true
  setgridlines y-axis false
 [color:red]  [/color] 
  ; set gridlines colors
  setgridlines x-axis color $rgb(200,200,200)
  setgridlines y-axis color $rgb(200,200,200)
 [color:red]  [/color] 
  ; set gridlines types
  setgridlines x-axis linestyle 1
  setgridlines y-axis linestyle 1
 [color:red]  [/color] 
  ; retrieving label objects
  %t = $com(x-axis,ticklabels,2,dispatch* x-labels) 
  %t = $com(y-axis,ticklabels,2,dispatch* y-labels) 
 [color:red]  [/color] 
  setfont x-labels size 8
  setfont y-labels size 8
  setfont x-labels color $rgb(60,60,60)
  setfont y-labels color $rgb(0,0,0)

Will get back to you on thursday more than likely cool


Gone.
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
Will get back to you on thursday more than likely cool


/me looks at the day of the week.... I was hoping to see this too!
If you have had a chance to work on it more maybe you could post an update?

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I haven't had the time to work on it, and the code that I was working on is still at home. I'm very busy these days, learning 2 programming languages at the same time (Scheme and C++), making mIRC non-prioritary right now.

If I have time in the weekend I'll finish it up and post it, else I'll post it either way, you'll be able to figure out the rest.


Gone.
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
thanks
I certainly appreciate the time you put in here to help others learn
(especially me) laugh

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I didn't go home last week, which is the reason for the extra week delay.

I can't seem to find the last version that I was working on, so this one has a little less functionality, more specifically regarding the legendkeys.

I don't feel at all like doing any sort of explanation/expanding/scripting on it, as it's something I only did because it was requested here, I have no personal benefit from making this.

To issue you use /chart, but note how I'm using my own filenames in the code so you'll have to replace it. Also note that you have to have a .csv that has data delimited by a certain char like ;,tab etc.

I hope you'll be able to figure out, cuz this comes straight from my script editor:

Code:
alias setfont {
  !.echo -q $com($1,font,2,dispatch* font)
  .comclose font $com(font,$2,4,uint,$$3)
}

alias setgridlines {
  return $com($1,hasmajorgridlines,4,bool,$2)
}

alias fillcolor {
  !.echo -q $com($1,fill,2,dispatch* fill)
  .comclose fill $com(fill,forecolor,2,dispatch* forecolor)
  .comclose forecolor $com(forecolor,schemecolor,4,uint,$2)
}

alias chart {
  var %t  
  .comopen excel.main excel.application
  %t = $com(excel.main,visible,4,bool,true)
  %t = $com(excel.main,workbooks,2,dispatch* excel.books)
  %t = $com(excel.books,open,1,bstr*,$mircdirgraph.csv,dispatch* excel.book)
  %t = $com(excel.main,worksheets,2,uint,1,dispatch* excel.sheet)
  %t = $com(excel.sheet,range,3,bstr,a1:y6,dispatch* excel.range) 
  %t = $com(excel.sheet,chartobjects,2,dispatch* chobjs)
  %t = $com(chobjs,add,1,uint,100,uint,60,uint,400,uint,200,dispatch* chart)
  %t = $com(chart,chart,2,dispatch* excel.chart)
  %t = $com(excel.chart,chartwizard,1,dispatch,excel.range,uint,4,uint,2,uint,1,uint,1,uint,1,bool,true,bstr,$+(Dalnet,$lf,$fulldate))

  ; retrieving objects to x and y axis
  %t = $com(excel.chart,axes,1,uint,1,dispatch* x-axis) 
  %t = $com(excel.chart,axes,1,uint,2,dispatch* y-axis) 

  ; retrieving label objects
  %t = $com(x-axis,ticklabels,2,dispatch* x-labels) 
  %t = $com(y-axis,ticklabels,2,dispatch* y-labels) 

  ; set x-axis label orientation to -90 degrees
  %t = $com(x-labels,orientation,4,int,-90)

  ; set labelticks for each hour  
  %t = $com(x-axis,TickLabelSpacing,4,uint,1)

  setfont x-labels size 8
  setfont y-labels size 8

  setgridlines x-axis true
  setgridlines y-axis true

  ; retrieve majorgridlinesobj and make color red
  %t = $com(x-axis,majorgridlines,2,dispatch* majorgridlines)
  %t = $com(majorgridlines,border,2,dispatch* border)
  comclose border $com(border,color,4,long,$rgb(255,0,0))

  %t = $com(excel.chart,chartarea,2,dispatch* area)
  fillcolor area 12

  %t = $com(excel.chart,charttitle,2,dispatch* title)
  setfont title size 8
  setfont title color $rgb(255,0,0)

  ; plotarea: border
  %t = $com(excel.chart,plotarea,2,dispatch* plotarea)
  %t = $com(plotarea,border,2,dispatch* border)
  comclose border $com(border,color,4,long,$rgb(255,0,0))

  ; plotarea color
  %t = $com(plotarea,fill,2,dispatch* fill)
  fillcolor plotarea 5

  ; plotarea outer and top coordinates
  %t = $com(plotarea,height,4,uint,99999)
  %t = $com(plotarea,top,4,uint,32)

  ; legend: font and fill color
  %t = $com(excel.chart,legend,2,dispatch* legend)
  setfont legend size 8
  fillcolor legend 6

  %t = $com(excel.chart,export,1,bstr*,$mircdirchart.jpg)
  :error
  tokenize 32 books sheet range charts chart
  if ($com(excel.book)) .comclose excel.book $com(excel.book,close,1,bool,false)
  if ($com(excel.main)) .comclose excel.main $com(excel.main,quit,1)
  comcloseall
}

alias comcloseall while ($com(1)) .comclose $v1


Gone.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I found the last version that I was working on by accident on my USB stick, so I will paste that one:

Code:
alias chart {
  var %t  
  .comopen excel.main excel.application
 ; %t = $com(excel.main,visible,4,bool,true)
  %t = $com(excel.main,workbooks,2,dispatch* excel.books)
  %t = $com(excel.books,open,1,bstr*,$mircdirgraph.csv,dispatch* excel.book)
  %t = $com(excel.main,worksheets,2,uint,1,dispatch* excel.sheet)
  %t = $com(excel.sheet,range,3,bstr,a1:y6,dispatch* excel.range) 
  %t = $com(excel.sheet,chartobjects,2,dispatch* chobjs)
  %t = $com(chobjs,add,1,uint,100,uint,60,uint,400,uint,200,dispatch* chartobj)
  %t = $com(chartobj,chart,2,dispatch* excel.chart)
  %t = $com(excel.chart,chartwizard,1,dispatch,excel.range,uint,4,uint,2,uint,1,uint,1,uint,1,bool,true,bstr,$+(Dalnet,$lf,$fulldate))
 [color:red]  [/color] 
  ; retrieving objects to x and y axis
  %t = $com(excel.chart,axes,1,uint,1,dispatch* x-axis) 
  %t = $com(excel.chart,axes,1,uint,2,dispatch* y-axis) 
 [color:red]  [/color] 
  ; set axes colors
  setborder x-axis color $rgb(255,0,0)
  setborder y-axis color $rgb(255,0,0)
 [color:red]  [/color] 
  ; show gridlines (true) or not (false)
  setgridlines x-axis true
  setgridlines y-axis false
 [color:red]  [/color] 
  ; set gridlines colors
  setgridlines x-axis color $rgb(200,200,200)
  setgridlines y-axis color $rgb(200,200,200)
 [color:red]  [/color] 
  ; set gridlines types
  setgridlines x-axis linestyle 1
  setgridlines y-axis linestyle 1
 [color:red]  [/color] 
  ; retrieving label objects
  %t = $com(x-axis,ticklabels,2,dispatch* x-labels) 
  %t = $com(y-axis,ticklabels,2,dispatch* y-labels) 
 [color:red]  [/color] 
  setfont x-labels size 8
  setfont y-labels size 8
  setfont x-labels color $rgb(60,60,60)
  setfont y-labels color $rgb(0,0,0)
 [color:red]  [/color] 
  ; set x-axis label orientation to -90 degrees
  %t = $com(x-labels,orientation,4,int,-90)
 [color:red]  [/color] 
  ; set labelticks for each hour  
  %t = $com(x-axis,ticklabelspacing,4,uint,1)
 [color:red]  [/color] 
  %t = $com(excel.chart,chartarea,2,dispatch* chartarea)
  fillcolor chartarea 44
 [color:red]  [/color] 
  %t = $com(excel.chart,charttitle,2,dispatch* title)
  %t = $com(title,left,4,uint,100)
  %t = $com(title,top,4,uint,5)
 [color:red]  [/color] 
  setfont title size 9
  setfont title color $rgb(255,0,0)
 [color:red]  [/color] 
  ; plotarea border
  %t = $com(excel.chart,plotarea,2,dispatch* plotarea)
  setborder plotarea color $rgb(255,0,0)
 [color:red]  [/color] 
  ; plotarea color
  fillcolor plotarea 2
 [color:red]  [/color] 
  ; plotarea outer and top coordinates
  %t = $com(plotarea,height,4,uint,99999)
  %t = $com(plotarea,top,4,uint,32)
 [color:red]  [/color] 
  ; legend font, fill color, border color
  %t = $com(excel.chart,legend,2,dispatch* legend)
 [color:red]  [/color] 
  setfont legend size 8
  setborder legend color $rgb(255,0,0)
  fillcolor legend 2
 [color:red]  [/color] 
  ; formatting legendkeys: type of line, weight, color
  legendkey 1 linestyle 1, weight 3, color $rgb(255,0,0)
  legendkey 2 linestyle 1, weight 3, color $rgb(0,255,0)
  legendkey 3 linestyle 1, weight 3, color $rgb(0,0,255)
  legendkey 4 linestyle 1, weight 3, color $rgb(255,0,255)
  legendkey 5 linestyle 1, weight 3, color $rgb(0,0,0)
 [color:red]  [/color] 
  %t = $com(legend,left,4,uint,311)
  %t = $com(excel.chart,export,1,bstr*,$mircdirchart.jpg)
 [color:red]  [/color] 
  :error
  tokenize 32 books sheet range charts chart
  scon -r if ($com(excel. $!+ $* )) .comclose $!ifmatch
  if ($com(excel.book)) .comclose excel.book $com(excel.book,close,1,bool,false)
  if ($com(excel.main)) .comclose excel.main $com(excel.main,quit,1)
  while ($com(1)) .comclose $ifmatch
}
 [color:red]  [/color] 
alias setfont {
  !.echo -q $com($1,font,2,dispatch* font)
  .comclose font $com(font,$2,4,uint,$3)
}
 [color:red]  [/color] 
alias setgridlines {
  if ($0 == 3) {
    !.echo -q $com($1,majorgridlines,2,dispatch* majorgridlines)
    setborder majorgridlines $2 $3
    .comclose majorgridlines
  }
  else return $com($1,hasmajorgridlines,4,bool,$2)
}
 [color:red]  [/color] 
alias fillcolor {
  !.echo -q $com($1,fill,2,dispatch* fill)
  .comclose fill $com(fill,forecolor,2,dispatch* forecolor)
  .comclose forecolor $com(forecolor,schemecolor,4,uint,$2)
}
 [color:red]  [/color] 
alias setborder {
  !.echo -q $com($1,border,2,dispatch* border)
  .comclose border $com(border,$2,4,int,$3)
}
 [color:red]  [/color] 
alias legendkey {
  ;  legendkey 4, linestyle -4118, weight 3, color $rgb(0,0,0)
  !.echo -q $com(legend,legendentries,2,uint,$gettok($1,1,44),dispatch* legendentry)
  .comclose legendentry $com(legendentry,legendkey,2,dispatch* legendkey)
 [color:red]  [/color] 
  tokenize 32 $remove($2-,$chr(44))
  while ($0) {
    setborder legendkey $1 $2
    tokenize 32 $3-
  }
  .comclose legendkey
}


Gone.

Link Copied to Clipboard