Syntax: #REA filename
Syntax: #REA filenum recnum arguments

Open the file given by filename and read it line by line, executing each line. This allows you to store commands in a script file and then execute this script.

The second form of this command reads data from the filenum file (opened with the FILE command). If filenum is 1-5, then the file is a text file and recnum is the line number to read. If recnum is zero or omitted, the next sequential line is read. If filenum is 6-10, then the file is a structured file, and the record indicated by recnum is read. If recnum is zero or omitted, the next record is read.

When reading from a file, argument references such as %1 are normally expanded using the arguments given in the #READ command. If the third parameter is _noexpand, then the line from the file is executed without replacing arguments.

READ examples

#REA mud.txt
Read the file mud.txt line by line and execute each line as if you had typed it manually.

#FILE 1 mudlist.txt
#READ 1 10
read the 10th line from the file mudlist.txt

If the 10th line in the file is "kill %1" then

#READ 1 10 "zugg"

will execute the "kill zugg" command.

Add comment

Login or register to post comments