GM Database Support v3.1.1 by Alasdair Forsythe (www.gmdatabase.co.uk)
This set of scripts is of very useful scripts that enable you to load a table from a database file and store it in a 2 dimensional array. Once a table has been copied into an array searches can be performed on it with much greater speed, although if the table is large then it may use up a lot of memory.
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: Array' 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 or adv.
Adv means it uses the advanced search which just means that:
If any of the scripts fail they return -1.
array_table
array_search
insert_array
array_table:
format: array_table(file_name,z,var,write)
argument types: array_table(string,adv,string,true/false)
This script either puts a table into a 2D array or puts it back
into a database.
array_search:
format: array_search(array_name,x,y,change_to)
argument types: array_search(string,adv,adv,string)
This script is similar to lookup_direct except it's used for arrays
that have been created with the array_table script.
There's no point using this script if you're only putting numbers
for both x and y, eg. if you want x3, y5 in the variable 'bob'
it's located at bob[3,5]. This script is so you can perform the
advanced searching methods on tables that have been loaded into
arrays.
insert_array:
format: insert_array(array_name,pos,col/row,ins/del)
argument types: insert_array(string,real,true/false,true/false)
This script is similar to insert_direct except it's used for arrays.