mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2007
Posts: 12
S
Sintel Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Mar 2007
Posts: 12
Is it possible to search for a specific line in a specific window/channel, and the ability to change that line by doing some operations on it like stripping the color codes etc.

I have looked around a bit but haven't found anything like it. If it's not possible in mirc, is there a dll that achieves this?

I could really use this to perfect the script I'm writing

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes, but it's going to need a lot of work.
I suggest you read the help file in the following areas:
/window
$strip

While the /window command does state a custom window, most of the /window commands will work with channel windows as well, and in the same manner.

Regarding the search, you would have to use $fline to find the line.

Please note that it's not possible for you to take someone else's text, then change it, before having it be processed via the server and displayed on everyone else's clients (exception being if the message is sent to you via pm/query first, then you send the altered message to the channel.)

Joined: Mar 2007
Posts: 12
S
Sintel Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Mar 2007
Posts: 12
Thanks. The $fline, /window etc. work fine with just the channel name (and scon if necessary) but it seems the /rline (/aline, etc.) commands really do require custom windows. I always get an invalid parameters error on any window except a true custom window.

So I got everything working except for the actual replacing part smirk any way around this?

Code:
var %loc = $fline($channel,$nick,$fline($channel,$nick,0,2),2)
rline $channel %loc $+(14,$strip($line($channel,%loc,0),c))

Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
To my knowledge you can't save the channels buffer with preserving the colours. So when you save the buffer remove what you want and reload it everything will be in your default text colour.

Not what you would want.

Why not force your own draw by using /haltdef? Check out /help /haltdef


$maybe
Joined: Mar 2007
Posts: 12
S
Sintel Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Mar 2007
Posts: 12
I'm already using haltdef for displaying text in a channel, but don't think that's the root of this problem. The windows the text need to be replaced in are still normal channel windows, not custom.

The problem is that it's apparantly not possible to manipulate the channel buffer at all (except for adding a line and clearing of course). However, like I said, it works perfectly on a custom window, preserving all the color, so I would guess if the command worked on a channel window, it would do so as well.

EDIT: ah now I get how you would go about changing the text, by saving the channel, manipulate the file and reload it.. But that's a really long way, involving disk operations and searching in a file, so even if it preserved color, certainly not optimal. the /rline command would be better, if it worked..

Last edited by Sintel; 11/03/07 12:53 PM.
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
I am well aware of that but since /*line commands don't work and /filter doesnt allow normal windows as the outfile we need to dump it to a file sadly.
Code:
alias rline.ex { 
  ;$1 = chan, $2 = line, $3- = new text
  window -h @chantowin
  filter -wwz $1 @chantowin *
  rline @chantowin $2-
  filter -wfcz @chantowin $scriptdirtmp.txt *
  loadbuf -r $1 $scriptdirtmp.txt
  .remove $scriptdirtmp.txt
  window -c @chantowin
}

However /savebuf doesn't save the line colour so for instance by default the topic is green in mIRC's default theme this green colour can't be saved.
So we have to echo all the line back in ourselves which is NOT a cool thing to do.

Code:
alias rline.ex { 
  ;$1 = chan, $2 = line, $3- = new text
  window -h @chantowin
  filter -wwz $1 @chantowin *
  rline @chantowin $2-
  var %t = $line(@chantowin,0), %c = 1
  clear $1
  while (%c <= %t) { 
    echo $line(@chantowin,%c).color $1 $line(@chantowin,%c)
    inc %c
  }
  window -c @chantowin
}

/rline.ex [CHAN] [N] [TEXT]
This will replace a line with what you want whilst preserving line colours

obviously this will become slower and slower as the buffer gets bigger.

We need /filter supporting #windows as outfile's or loadbuf prefixing lines with there line colour code.

Last edited by Mpdreamz; 11/03/07 01:45 PM.

$maybe
Joined: Mar 2007
Posts: 12
S
Sintel Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Mar 2007
Posts: 12
I see, learned some more commands from your code smile. If this is the only way, it's not a feasible solution for me however. I wanted to do this on every QUIT event. One of the channels I'm usually in has 1700 users and 20+ joins/quits per minute, as well as a whole lot of talking going on. The extra computational strain this brings is not worth the feature. I was already annoyed that I had to use 2 $fline, so the channel gets searched 2 times while all I want is the location of the last time someone said something.

The concept I wanted to use it for is this: at the moment I'm displaying all quits/parts/join in the status window, since displaying in a channel with any reasonable amount of activity/talking is very disturbing, especially since the user is not interested in 99% of the joins/quits/parts. However, having no visual clues in the channel when someone leaves a conversation you were in, can lead you to talking to someone who has left.

So I wanted to change/dim the color of the last line that person spoke when they quit.

So this (5th line from the bottom, GB chap): http://users.skynet.be/TailwinD/test0.png
would change into this (maybe bad choice of color): http://users.skynet.be/TailwinD/test1.png
only the last line, not every line as you can see. Don't mind the timestamp, that's me copy-pasting stuff.

my status looks like this for that channel, which is why I don't want it to interfere in the channel: http://users.skynet.be/TailwinD/status.png

I guess I'll try feature requesting smile or maybe there's a dll that does this..

Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
I made this addon once, that might help ya ? Its seriously due an update though :p

Yeah /savebuf needs a switch to allow for linecolours to be saved as well. Or filter needs to support channels as output windows.
I posted a Feature suggestion for this. I like your idea smile

Last edited by Mpdreamz; 11/03/07 04:33 PM.

$maybe

Link Copied to Clipboard