ReadArrayFromFile

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
< [[::Category:Functions|Category:Functions]]

A function added by the JIP NVSE Plugin.

Description

Reads data from the specified file and stores it in an array variable.

If the file contains a single line of data, the function returns a standard, list-type array. Otherwise, it returns a matrix, where the first index is the column number and the second index is the row number (someArray[column][row]).

The file must be formatted accordingly:

  1. Values must be separated with tabs (one or more).
  2. When using non-numeric types as values:
    • Strings must be prefixed with '$'. Example: $Brave men run, in my family.
    • References must be prefixed with '@', followed by the source file name, then ':', and finally the six-digit reference ID (i.e. without the mod index). Example (for Craig Boone): @FalloutNV.esm:096BCE

Syntax

[help]
(array_var) ReadArrayFromFile filePath:string

Example

496	-1.26	-12	0.514	0	2009	-100.8004

The above will return an array of numbers, with 7 elements.

$they can lie	$to my face	$but not	$to my heart

The above will return an array of strings, with 4 elements.

@FalloutNV.esm:135F19	@LonesomeRoad.esm:003E43		@DeadMoney.esm:00A7A9

The above will return an array of references, with 3 elements.

0.514	$if we all	-12	@DeadMoney.esm:00A7A9	@FalloutNV.esm:135F19	$stand together

The above will return an array of mixed-type values, with 6 elements.

52	14	7	9
110	2	20	51
10	99	0	61
-5	37	39	45
35	17	496	-12

The above will return a matrix of numbers, with 4 columns and 5 rows.

@FalloutNV.esm:135F19		496		$they can lie to my face
@LonesomeRoad.esm:003E43	-1.26		$but not to my heart
@DeadMoney.esm:00A7A9		-12		$if we all stand together
@FalloutNV.esm:022108		0.514		$it will just be the start

The above will return a matrix of mixed-type values, with 3 columns and 4 rows.

Notes

  • filePath is relative to the game's installation path.

See Also