Make your own free website on Tripod.com

A.G.S. v2.21
Text Script Commands Manual by Spyros

Main Page
Character

Cursor
Dialogue
Display
File
Game
GUI
Inventory
Music,Sound,Flic

Palette
Object

Room
Screen
String

 

FileClose (int handle)
Closes the file with handle HANDLE, and commits all changes to disk.
You MUST close the file after you have finished with it.
Example:
FileClose(myfile);

FileOpen (string filename, int mode)
Opens a disk file for reading or writing. These disk I/O functions are only intended for simple tasks like the way the QFG series export the character when you complete it. MODE is either FILE_READ or FILE_WRITE, depending on
whether you want to write to or read from the file.
If you pass FILE_WRITE and a file called FILENAME already exists, it will be overwritten. This function returns a file handle, which you use in future calls to file functions, or returns 0 if there was a problem (eg. file not existing
when MODE is FILE_READ).
IMPORTANT: If you want to include a path as well as filename, you MUST use
forward slashes '/' and NOT back-slashes '\'. Using back-slashes may cause
the program to crash when it tries to compile your script. For example,
use this: "c:/temp/myfile.tmp" instead of this: "c:\temp\myfile.tmp".
Example:
int handle = FileOpen ("temp.tmp", FILE_WRITE);
if (handle == 0) Display("Error opening file.");
else {
FileWrite (handle, "test string");
FileClose (handle);
}

FileRead (int handle, string buffer)
Reads a string into BUFFER, from a file previously opened with FileOpen which returned HANDLE. You should only use this with files which you previously wrote out with FileWrite. Do NOT use this function with any
other files, even text files.
Example:
FileRead(myfile,buffer);

FileReadInt (int handle)
Reads an integer from the file HANDLE, and returns it to the script.
Only integers written with FileWriteInt can be read back.
Example:
FileReadInt (myfile);

FileReadRawChar (int handle)
Reads a raw character from the input file HANDLE and returns it. This function allows you to read from files that weren't created by your game, however it is recommended for expert users only.
Example:
FileReadRawChar (myfile);

FileReadRawInt (int handle)
Reads a raw 32-bit integer from the input file and returns it to the script. This allows you to read from files created by other programs - however, it should only be used by experts as no error-checking is performed.
Example:
FileReadRawInt (myfile);

FileWrite (int handle, string text)
Writes TEXT to the file HANDLE, which must have been previously opened with FileOpen for writing. The string is written using a custom format to the file, which can only be read back by using FileRead.
Example:
FileWrite (myfile, "I am OK");

FileWriteInt (int handle, int value)
Writes VALUE to the file HANDLE. This allows you to save the contents of variables to disk. The file must have been previously opened with FileOpen, and you can read the value back later with FileReadInt.
Example:
FileWriteInt (myfile,16);