WriteStringToFile

< [[::Category:Functions|Category:Functions]]

A function added by the JIP NVSE Plugin.

Description

Similar to ReadStringFromFile, only this function writes a string into a file.

  • If the file does not exist, it is created.
  • If append is non-zero, the new string is appended at the end of the file, otherwise all existing data is erased and overwritten.

Syntax

(successful:0/1) WriteStringToFile filePath:string append:0/1 sourceString:formattedString formatVars(up to 20)

Example

WriteStringToFile "data_file.txt" 1 $strVar
WriteStringToFile "data_file.txt" 1 "Two times four is %g and no more.%rIts name is %n" intVar refVar

Notes

  • filePath is relative to the game's installation path.
  • sourceString supports format specifiers, and up to 20 variables may be used.

See Also