Menu

Commit [r2781]  Maximize  Restore  History

New Functions

createfilestream() - makes a new blank filestream that can be added to, returns filestream index

savefilestream(int filestreamindex, "filepath") - saves the specified filestream at Saves\PAKNAME\filepath
-Mods cannot save data anywhere besides Saves\PAKNAME\ to prevent mods from overwriting each another mod's save data. They can read from anywhere in the Saves directory though, so mods can do things based on save data from other mods.
-Automatically adds a blank line to the end of the file so it can be read without issues.
-Costly operation. You can get away with calling it ingame on Windows, but it makes a lag spike when called ingame on PSP (and presumably, other consoles).

filestreamappend(int filestreamindex, scriptvar, 0/1) - adds scriptvar to the end of the specified filestream
- 0 (default): for writing commands, creates a new line before writing
- 1: for writing arguments
This command adds a space after anything appended so that arguments can be distinguished. I wanted to just add a space before an argument append but could not for the life of me persuade C to go along with it.

Modified Functions:

openfilestream("filepath", int x) - loads the file at filepath into a new filestream, returns filestream index
- x = 0 (default): loads file from inside the pak (or base directory if running the mod as a data folder)
- x = 1: loads file from Saves directory
IE: openfilestream("PACKNAME/file.txt", 1); would open the file at Saves/PACKNAME/file.txt.

kbandressen 2010-05-11

MongoDB Logo MongoDB