Script autoloading
by Patrick Shaw · in Torque Game Builder · 02/06/2007 (5:58 am) · 2 replies
Hi all,
I have written a script that scans my gameScripts directory and executes each one...
This works great until I package my game which deletes the *.cs files. The "findFirstFile" function then finds nothing and executes no scripts. I have spotted the findFirstFileMultiExpr which "Finds a file on the file system matching one of several patterns." However, how do I pass multiple patterns to this function? I've tried spaces, commas, semicolons, etc.
I have written a script that scans my gameScripts directory and executes each one...
function loadScripts(%pattern) {
echo("begin load...");
%filename = findFirstFile( %pattern);
while("" !$= %filename) {
echo("loading..." SPC %filename);
exec(%filename);
%filename = findNextFile( %pattern );
}
}
loadScripts("~/gamescripts/*.cs");This works great until I package my game which deletes the *.cs files. The "findFirstFile" function then finds nothing and executes no scripts. I have spotted the findFirstFileMultiExpr which "Finds a file on the file system matching one of several patterns." However, how do I pass multiple patterns to this function? I've tried spaces, commas, semicolons, etc.
About the author
Associate David Higgins
DPHCoders.com