File Library


File Actions

The File Actions deal with two different file types - Buffer files and Ini files - and also have certain generic file actions to rename or copy existing files. Buffer files are created by saving out the data from a buffer that you have previously created and this data can then be loaded into a buffer again at any time in the future. You can find out more information about buffers here: Buffer Actions.

Ini files are small, lightweight files which are compatible with most platforms. They are ideal for storing small pieces of information, like interface preferences, local high scores, level data etc... and are very easy to use. Ini files don't have to have been created previously to use these actions, and you can read from a non-existent Ini file and you'll simply get a default return value (which you specify), however we recommend that you create at least a "base" ini file for opening and modifying before using the actions. This base ini file can be created by simply calling the Open Ini File action followed by the Close Ini File, since closing the file will write it to the disk, or yu can include one in the Included Files of the resource tree. If you are using a file included in the resource tree as your base Ini, you should also read the section of the manual about how the File System works.

注意: For games with localizations it is very important that accented letters can be read from external files. This means that you should create the ini file in UTF8 format first and then add it into GameMaker Studio 2 as an included file so that it is exported on running the game and used instead of the default ANSI format ini file that is created by the ini functions when none has been previously supplied. 通过这种方式,你可以正确地读取和写入所有重音和非罗马字母。


The following actions exist for working with files:

载入缓冲区 载入缓冲区
保存缓冲区 保存缓冲区
重命名文件 重命名文件
复制文件 复制文件
删除文件 删除文件
打开ini文件 打开ini文件
关闭ini文件 关闭ini文件
写入ini文件 写入ini文件
读取ini文件 读取ini文件
如果文件存在 如果文件存在