mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2006
Posts: 98
L
Lloyd_B Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: May 2006
Posts: 98
I've been trying to search for this since I'm sure someone else had this request but I couldn't find this specifically.

I'm looking for help in using $read to look for specific text in a file (which I know is it's purpose and I can do that) but then continue to read and display lines from additional lines after it's first match until it can't find matching text anymore.


Lloyd
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
$readn will return the last line number that was read, this can be used with $calc and additional calls to $read(file,n) to get what you want.

Joined: May 2006
Posts: 98
L
Lloyd_B Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: May 2006
Posts: 98
Thank you, thank you, thank you.

That actually helped me figure it out. I'm working on it right now.

I should've known that but I haven't scripted in years and it's taking some time to refresh my memory and relearn things.


Lloyd
Joined: May 2006
Posts: 98
L
Lloyd_B Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: May 2006
Posts: 98
Now I have a new problem, I'm getting an error of insufficient parameters on this line:

msg $chan $read(C:\Dropbox\lloydbot_data\events02.txt,nr,%eventmonth,%eventread)

%eventmonth is a string that can go from -01- to -12- and the %eventread is obviously a number that gives the line to read from.

The script seems to still work but getting the error obviously means something.

Edit:
It doesn't seem to be the $read() identifier. No matter what I put on that line it gives:
* /msg: insufficient parameters (line 30, bot-remote-familab.mrc)

Last edited by Lloyd_B; 25/04/15 07:48 PM.

Lloyd
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Are you trying to msg an empty line?

Joined: May 2006
Posts: 98
L
Lloyd_B Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: May 2006
Posts: 98
Nope, it's not empty. Right now it has:

msg $chan %eventdata

I thought perhaps the $read() identifier had a problem so I made the variable %eventdata carry that information. I'm totally lost on this. I even have similar data on other lines but they're not causing an error.

Edit:
You mentioning an empty line made me suspicious of something. Somehow, the script was generating an empty line at the very end of it's execution. So, I put a plain character on the very front before the variable and it showed up. Now I know what I'm working with. Thanks again for your reply.

Last edited by Lloyd_B; 25/04/15 08:18 PM.

Lloyd

Link Copied to Clipboard