file Skybox Checker

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
01 Jun 2013 03:32 #1 by Jeff
Skybox Checker was created by Jeff
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

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

More
01 Jun 2013 09:05 #2 by Trace
Replied by Trace on topic Skybox Checker
Any chance you could add an option to it to modify the skybox to a default one if the the skybox is not found?

Please Log in or Create an account to join the conversation.

More
01 Jun 2013 17:51 #3 by Aayrl
Replied by Aayrl on topic Skybox Checker
To extend on Trace's concept, it's possible to simply read through the skybox directory and generate an array of all of the possible skyboxes. I'm curious if you could randomly assign a skybox from this array each time you load a mission.

~Aayrl

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
01 Jun 2013 22:20 #4 by Jeff
Replied by Jeff on topic Skybox Checker
^ has already been done in PR I believe. I know I coded that a while ago. Easy as eating a slice of pie with whipped cream.

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

More
02 Jun 2013 23:08 #5 by CyberFox
Replied by CyberFox on topic Skybox Checker
i actually did something similar with my MatrixMaze levels:
Code:$skybox_url = getrandom(4);
if ( $skybox_url == 0 ){
    $skybox_url = ~/data/skies/intermediate/intermediate_Sky.dml;
    $sun_1 = 0.531491 -0.606518 -0.591314;
    $sun_2 = 1.000000 0.900000 0.200000 1.000000;
    $sun_3 = 0.300000 0.300000 0.240000 1.000000;
}
else if ( $skybox_url == 1 ){
    $skybox_url = ~/data/skies/beginner/beginner_Sky.dml;
    $sun_1 = -0.444514 0.746881 -0.494547;
    $sun_2 = 1.000000 1.000000 1.000000 1.000000;
    $sun_3 = 0.300000 0.300000 0.300000 1.000000;
}
else if ( $skybox_url == 2 ){
    $skybox_url = ~/data/skies/expert/expert_Sky.dml;
    $sun_1 = 0.444514 -0.746881 -0.494547;
    $sun_2 = 0.600000 0.600000 0.600000 1.000000;
    $sun_3 = 0.300000 0.300000 0.450000 1.000000;
}
else if ( $skybox_url == 3 ){
    $skybox_url = ~/data/skies/advanced/advanced_Sky.dml;
    $sun_1 = -0.668065 -0.506593 -0.545026;
    $sun_2 = 1.600000 1.600000 1.600000 1.000000;
    $sun_3 = 0.400000 0.400000 0.400000 1.000000;
}
else{
    $skybox_url = ~/data/skies/bonus/bonus_Sky.dml;
    $sun_1 = -0.00945897 -0.68078 -0.732427;
    $sun_2 = 0.600000 0.600000 0.250000 1.000000;
    $sun_3 = 0.400000 0.400000 0.300000 1.000000;
}

You could lots of fun shizzle to make you levels a less repetitive.

Use altcode 0160 to make a non breaking space or write   the other is just bad style...

Please Log in or Create an account to join the conversation.

More
03 Jun 2013 22:31 #6 by Aayrl
Replied by Aayrl on topic Skybox Checker
Perfect, Cyberfox. I was on a work machine at the time and did not have the opportunity to write one up myself - figured someone had it already and could toss it in the MBDK for anyone that was looking for the functionality.

~Aayrl

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
04 Jun 2013 03:45 #7 by Jeff
Replied by Jeff on topic Skybox Checker
nice one CF

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

Moderators: AayrlKalle29Regislian