This code was origionally from marble blast emerald, and then went into old dead Project Revolution.
It checks to see if a skybox is missing. Simple as that.
To use:
echo(levelSkyWorks(path_to_file.mis));
Will return 1 or 0, one obviously being yes, a skybox exists.
Code:function levelSkyWorks(%file) {
%fo = new FileObject();
%sky = ;
if (%fo.openForRead(%file)) {
while (!%fo.isEOF()) {
%line = %fo.readLine();
%line = trim(%line);
if (strStr(%line, materialList = \) != -1) { //Here we have it!
%sky = getSubStr(%line, 16, strLen(%line)); //Getting a little tricky...
%sky = getSubStr(%sky, 0, (strLen(%sky) - 2));
break;
}
}
%fo.close();
}
if (isFile(expandFilename(%sky))) {
%skyIsOk = true;
}
%fo.delete();
return %skyIsOk;
}
Enjoy
It checks to see if a skybox is missing. Simple as that.
To use:
echo(levelSkyWorks(path_to_file.mis));
Will return 1 or 0, one obviously being yes, a skybox exists.
Code:function levelSkyWorks(%file) {
%fo = new FileObject();
%sky = ;
if (%fo.openForRead(%file)) {
while (!%fo.isEOF()) {
%line = %fo.readLine();
%line = trim(%line);
if (strStr(%line, materialList = \) != -1) { //Here we have it!
%sky = getSubStr(%line, 16, strLen(%line)); //Getting a little tricky...
%sky = getSubStr(%sky, 0, (strLen(%sky) - 2));
break;
}
}
%fo.close();
}
if (isFile(expandFilename(%sky))) {
%skyIsOk = true;
}
%fo.delete();
return %skyIsOk;
}
Enjoy
I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.