Skip to content
MicroBlaster edited this page Dec 11, 2020 · 3 revisions

Purpose: Reads a line of a text from a text file.

Syntax: read {file} storageVar {line}

{file}: The file to read text from.

storageVar: The variable to store the line in.

{line}: The line number to read.

Notes: This command attempts to read a line of text from a file. If the file does not exist, an error is raised. If the line is past the end of the file, 'EOF' is returned.

Example:

Create a var to hold file name. The system var GAMEDATA points to

the TWXP\DATA\MyGame folder which is created for each game.

$BustFile := GAMEDATA & "busts.txt"

load bust list

if ($BustFile <> "") fileExists $exists $BustFile

if ($exists) setArray $BustList SECTORS setVar $i 1 read $BustFile $bust $i while ($bust <> EOF) setVar $BustList[$bust] 1 add $i 1 read $BustFile $bust $i end end end

Clone this wiki locally