mIRC Homepage
Posted By: samplekoko Reading multiple lines in a script? - 15/10/15 06:01 AM
Hi, I was wondering if it was possible (and if so, how) to read multiple lines from chat. By this, I mean both or either being able to see text/lines that were previously written or waiting for more messages to be received from the channel and being able to work with that string.

Thank you in advance!
Posted By: OrFeAsGr Re: Reading multiple lines in a script? - 15/10/15 03:38 PM
Well if i understood what you mean.. the only ways i know that would make you able to see previous lines is using a znc which keeps the messages when you're offline and sends you them when you log in. You can find some free bnc services if you search Google for Free bnc.
And the other way is probably not so suitable for you cause it's a channel mode and i only have seen it in inspircd .. +H lines:seconds saves X lines from Y seconds ago.. and when someone joins the channel it sends the lines to them.
Apart from these there's not a way (or at least that's what i know) to be able to see messages that were sent when you weren't on the channel.
smile
Posted By: samplekoko Re: Reading multiple lines in a script? - 15/10/15 07:33 PM
Ah, I didn't mean that. For example, let's say there's an ON Text event and I wanted to see the last X lines before that text event (given that I was in the channel at the time). Or I want to have an ON Text event and get the lines that come after that one.

Essentially, I want to be able to manipulate/use more lines from the channel than just the one that triggers the event.
Posted By: OrFeAsGr Re: Reading multiple lines in a script? - 16/10/15 12:03 AM
Oh i'm sorry i didn't get it the 1st time laugh
In that case you could keep the X last lines in a .txt or .ini file.
If you want to keep X lines after a line you should use on text event to recognize that line and then set a variable. So then if the variable exists you save the amount of lines you want.
smile
Posted By: samplekoko Re: Reading multiple lines in a script? - 16/10/15 12:45 AM
No worries! I worded it pretty poorly.

I don't wanna go with the external route as I/O would be slower than I want this to be, but thanks for the suggestion. Might be useful to think about in some future use case.

I guess using a global variable would be the best way to do this, but it feels wrong to be using global variables like this. I guess that's the limitations of mIRC scripting.
Posted By: pball Re: Reading multiple lines in a script? - 16/10/15 02:44 AM
You could use a hash table to store a large buffer of lines.
© mIRC Discussion Forums