GM Database Support v3.1.1 by Alasdair Forsythe (www.gmdatabase.co.uk)

Advanced: Extra Scripts

These scripts are less useful than the others, although I'm sure many of you will find a use for some of them. They were much more useful before the new data file handling ability of Game Maker 5 which is of great use, as you can see from the examples.

Remember that if you're not using encryption then you'll need to add a blank script called 'encryption' anyway.

To import these scripts into your game select 'Import Scripts' from the Game Maker 'File' menu and then locate the 'Database: Extra' script file. You should delete any scripts that you're not using so as the game will load faster.

To call the scripts use the format as shown below. You can call a script at any time during the game.
Eg. to set the variable jeff to the value of the 4th column, 3rd row, in the 1st table of database file data.txt use:

jeff=lookup_direct('data.txt',1,4,3)

On the overviews of the scripts below the format shows you what to put in each argument.

Argument types is the type of argument required: string, real.

If any of the scripts fail they return -1.

convert_direct
database_create


convert_direct:
format: convert_direct(file_name,encrypt?)
argument types: convert_direct(string,true/false)

This script converts the whole database file between encryptions.

This script may be useful to decrypt the whole file at the start of the game and encrypt it again at the end, then when you come to use the other scripts they'll run much faster as they won't have to decrypt each line they want to read on the spot.

 

database_create:
format: database_create(file_name,tables,cols,rows)
argument types: database_create(string,real,real,real)

This script creates (or wipes) a blank database file.