mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2004
Posts: 755
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 755
A spin-off off this thread.
It would be really handy if /filter supported normal (channels etc) windows as the output buffer.
Or a savebuf switch that prefixes line colours so you can save and loadbuf a channel window without losing the colouring.


Joined: Oct 2006
Posts: 166
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
I would like to see this addition because I had to save my results into a file then load them into channels. so that would be so handy.

S
Sintel
Sintel
S
I would like to add to this, as a spin off from the thread as well. Just to be clear, I also think the usefulness to extend these functions is there. But there are 2 other changes that are a more direct path and less computationally intense to accomplish what I set out to do.

The first is, having the /*line commands work on other windows than custom, through their name - but then we have to watch out for same name channel/query/whatever on different networks, so it'd be dependent on which "scon" it is executed, or through a globally unique identifier like the window id.

Also, since we're changing stuff anyway, I never quite understood the usefulness of having the optionally first number be interpreted as the line color, when a ctrl-k + number before the line achieves the same thing, and no confusion would arise from that. Although I do understand that changing the signature from a function is a big deal that can break some scripts.

The second one is the $fline identifier. From my courses at uni, I know that finding text is a pretty complex process to do right, so I wonder if the identifier could be changed or adapted to do less of it. One way would be to have a new field like $fline(*,*,0,*).last, so you can directly get the line number of the last occurrence (the first one is easy by changing the 0 into 1), without having to use $fline twice. That's some extra memspace tho. Another option could be to have any larger number than the amount of occurrences be interpreted as the last occurrence, like change the 0 in 1000 and if there are only 67 occurrences, return the line number of the 67th occurrence.

The last thing I can think of and maybe the best in this specific scenario, is a new identifier that works almost exactly as the ctrl-f (find) function and complements the $fline by doing the same thing the other way around. $find(*,N) with .text field, that starts searching from the bottom up and returns the line number from the Nth occurrence. This function could also integrated in $fline by having a fifth field that would indicate direction (1=up/0=down) instead of always counting by going down.

Sorry for the large amount of text smile

Joined: Apr 2004
Posts: 755
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 755
Originally Posted By: Sintel

The last thing I can think of and maybe the best in this specific scenario, is a new identifier that works almost exactly as the ctrl-f (find) function and complements the $fline by doing the same thing the other way around. $find(*,N) with .text field, that starts searching from the bottom up and returns the line number from the Nth occurrence. This function could also integrated in $fline by having a fifth field that would indicate direction (1=up/0=down) instead of always counting by going down.

Sorry for the large amount of text smile


/filter is for a mIRC command shockingly fast smile A scripted command using /filter to find a line in a channel window is already possible without being slow at all. The problem arises is when you want to filter/loadbuf into a channel window. /filter doesnt allow channel (normal) windows as the output buffer. savebuf doesnt allow you to save line colours rendering /loadbuf useless in this case.

/*line support for channel (normal) windows would work as well.

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
Searching backwards via $fline() is already possible using a negative number for the index. $fline(@moo, *hello*, -1) finds the last line containing "hello".

Edit: Nevermind, no it isn't (see below).

Last edited by starbucks_mafia; 12/03/07 04:14 PM.
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
$fline() with a negative index is just the same as $fline() with 0, ie returns the total number of lines.

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
So it does. I figured -1 might work so I tried it and got the answer I expected, presuming it would've failed if it wasn't a valid index. Guess I should've tried with -2 or -3 to make sure.

Oh well, the negative index is definitely the way to go for supporting this feature though.


Link Copied to Clipboard