Originally Posted by lastyle
i want to read a line from a file and then parse the text to a channel, but mirc responds with "to many arguents" in the libe where i want to check if the file exists.
To test your code I put it in an alias. Further, if I correctly understood the logic of your idea, I made some corrections and additions to the code.


Try using this snippet script code:
Code
alias fileread {
  if (!$1) { echo -a 10ERROR - Enter the line number of the file being read as the first argument. | return }
  var %file D:\leechme.txt, %line $1, %lines $lines(%file)
  if ($isfile(%file)) {
    if ($file(%file)) {
      if (%line <= %lines) var %str $read(%file,nt,%line)
      else echo -a 10ERROR - The file has fewer lines. Total: %lines
      if (%str) msg #welcomechat $+(%line,.) %str
    }
    else echo -a 10ERROR - File is empty or an error occurred while reading: %file
  }
  else echo -a 10ERROR - File does not exist: %file
}

Syntax: /fileread <number>
Example: /fileread 1


🕮 Also review the following documentation to understand where you may have made mistakes and how to correctly use some of the identifiers in this code:



🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples