INI File Parser

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

A User Function for use with Oblivion Script Extender


Syntax:

INIParser ValuesArray 

Walks through the path list array, initializes valid files using runBatchScript and returns the number of files processed.


Examples:[edit | edit source]

Let MyArray := ar_Construct Array
Let MyArray [0] := "Data\Qwerty.ini"
Let MyArray [1] := "Data\INI\Qwerty.ini"
   . . .
Let MyArray [NN] := ValueNN
Let NumINIProcessed := call INIParser MyArray

; --- or just ---

set NumINIProcessed to call INIParser ar_list Value01, Value02, Value03, . . . , ValueNN ;(up to 20 values)


Code[edit | edit source]

scn INIParser

array_var aINIFiles
array_var aIterator

short sNumOfINIs

string_var svPath

begin function { aINIFiles }
	let aIterator := ar_Construct StringMap

	forEach aIterator <- aINIFiles
		let svPath := aIterator[ "value" ]

		if eval( fileExists $svPath )
			let sNumOfINIs += 1
			runBatchScript $svPath
		endIf
	loop

	setFunctionValue sNumOfINIs
	sv_Destruct svPath
end

See Also[edit | edit source]