file Skybox Checker

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
01 Jun 2013 03:32 #1
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.

  • Posts: 301
  • Thank you received: 57
01 Jun 2013 09:05 #2
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.

  • Posts: 1118
  • Thank you received: 370
01 Jun 2013 17:51 #3
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
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
01 Jun 2013 22:20 #4
^ 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.

  • Posts: 122
  • Thank you received: 0
02 Jun 2013 23:08 #5
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.

  • Posts: 1118
  • Thank you received: 370
03 Jun 2013 22:31 #6
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
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
04 Jun 2013 03:45 #7
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: Doomblah
Time to create page: 1.472 seconds