I'm looking for a way to create a map of all script resources, this is for use in my proposed system for the GMCG. It would be very useful to be able to keep track of the scripts without having to manually add them to a list.
As I'm sure many of you know there are a number of resource mapping scripts on gmlscripts.com; unfortunately there is no script for mapping scripts, I'm assuming this is because the author hit the same hurdle...
The problem is that no scripts can be created in game and therefore the maximum number of scripts cannot be determined. The only logical workaround I can think of is to have the caller guess the maximum number of ids (of course if you enter a huge number you're fairly sure you'll get all the scripts).
So basically my question is, is this the best way of doing this?
// scr_map_scripts(map, max)
// We assume there are no more than 'max' script ids
// Is this really the best solution?
for (i = 0; i < argument1; i += 1)
ds_map_add(argument0, script_get_name(i), i);
Your expert opinion would be appreciated, thanks,