mIRC Home    About    Download    Register    News    Help

Topic Options
#265113 - 10/03/19 02:56 AM Get first lines of /names command
miguelpucela Offline
Self-satisified door

Registered: 10/03/19
Posts: 4
Loc: Spain
Hello,
I'm trying to make a script that echos the first 3 lines of the output of the comand /names #channel.

I've being guessing of geting the output of names command into a variable, but I don't know how to do it.

I supose there's a better way to do it.

Any help or tip is welcome.

Thank you in advance.
Miguel

Top
#265114 - 10/03/19 09:40 AM Re: Get first lines of /names command [Re: miguelpucela]
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2566
Why only the first 3 lines?

Is it a channel that you're already in? If so, you can just use $nick(#,%i) to iterate though them.

RAW 353:*: { } will fire for each line of names listings

RAW 366:*: { } will fire for End of /Names List.

Use /debug -p @debug
_________________________
At least I won lunch.
Good philosophy, see good in bad, I like!

Top
#265115 - 10/03/19 04:43 PM Re: Get first lines of /names command [Re: Raccoon]
miguelpucela Offline
Self-satisified door

Registered: 10/03/19
Posts: 4
Loc: Spain
I want to make a command to execute it in the status window. Let's say I want to print the first N lines of the names output of the M input arguments of the command:

/mycommand #chan1 #chan2 ... #chanM 4

The output should be the first 4 lines of the /names output of the M channels.

Another option could be to print the last M users connected to each channel.

Top
#265118 - 11/03/19 12:43 AM Re: Get first lines of /names command [Re: miguelpucela]
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2566
Are these channels that you are already joined to, or are these channels that you are sitting outside of?
_________________________
At least I won lunch.
Good philosophy, see good in bad, I like!

Top
#265129 - 11/03/19 05:45 PM Re: Get first lines of /names command [Re: Raccoon]
miguelpucela Offline
Self-satisified door

Registered: 10/03/19
Posts: 4
Loc: Spain
In principle these are channels I'm sitting outside of.

Top
#265249 - 22/03/19 07:04 PM Re: Get first lines of /names command [Re: miguelpucela]
Erasimus Offline
Babel fish

Registered: 26/04/18
Posts: 61
I too don't understand why you only want the 1st 3 lines.

I also dont understand why you find this difficult.
Code:
 
; set line counter to 1 and then only echo the lines 1-3
; to the status window. Use haltdef to prevent mIRC
; from sending any line to status window.
; needs to be set at some point -- say @ raw 001
On raw 001 :*: {
   Set %LineCounter 1
}

On raw 353:*: {
   if (%LineCounter <= 3) { //echo -s $1- }
   inc %LineCounter
   haltdef
}

; reset counter to 1 ready for next channel
On raw 366:*: { %LineCounter = 1 }


Of course this will affect any usage of the /names command, so you could set a variable in your 'mycommand' which you test for in the above on raw events, then reset that variable at the end of your command, to allow for normal usage.


Edited by Erasimus (22/03/19 07:19 PM)

Top
#265252 - 22/03/19 10:52 PM Re: Get first lines of /names command [Re: Erasimus]
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2566
Not every network outputs RAW 001. Use On Connect instead to initialize your variables.
_________________________
At least I won lunch.
Good philosophy, see good in bad, I like!

Top
#265253 - Yesterday at 01:19 AM Re: Get first lines of /names command [Re: Erasimus]
miguelpucela Offline
Self-satisified door

Registered: 10/03/19
Posts: 4
Loc: Spain
The final objective is to get the last users connected to several channels in only one command invokation.

I'm new to mirc scripting. That's why I find this difficult eek

Thank you for your help.

Top