08.11.2012 Views

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

file_bin_close(fileid) Closes the file <strong>with</strong> the given file id.<br />

file_bin_size(fileid) Returns the size (in bytes) of the file <strong>with</strong> the<br />

given file id.<br />

file_bin_position(fileid) Returns the current position (in bytes; 0 is<br />

the first position) of the file <strong>with</strong> the given file id.<br />

file_bin_seek(fileid,pos) Moves the current position of the file to the<br />

indicated position. To append to a file move the position to the size of the file<br />

before writing.<br />

file_bin_write_byte(fileid,byte) Writes a byte of data to the file <strong>with</strong><br />

the given file id.<br />

file_bin_read_byte(fileid) Reads a byte of data from the file and<br />

returns this.<br />

If the player has checked secure mode in his preferences, for a number of these routines, you<br />

are not allowed to specify a path, and only files in the application folder can e.g. be written.<br />

If you included files in the game executable and did not automatically export them at the start<br />

of the game, you can use the following functions to do this.<br />

export_include_file(fname) Exports the included file <strong>with</strong> the name<br />

fname. This must be a string variable, so don't forget the quotes.<br />

export_include_file_location(fname,location) Exports the included<br />

file <strong>with</strong> the name fname to the given location. Location must contain the path<br />

and the filename.<br />

discard_include_file(fname) Discard the included file <strong>with</strong> the name<br />

fname, freeing the memory used. This must be a string variable, so don't<br />

forget the quotes.<br />

The following four read-only variables can be useful:<br />

game_id* Unique identifier for the game. You can use this if you need a<br />

unique file name.<br />

working_directory* Working directory for the game. (Not including the<br />

final backslash.)<br />

program_directory* Directory in which the game executable is stored. (Not<br />

including the final backslash.) When you run a standalone game this is<br />

normally the same as the working directory unless the game e.g. opens a file

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!