Advertisement
Guest User

scrCreateSectionFromString

a guest
Sep 21st, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var _currentXSection = argument0;
  2. var _currentYSection = argument1;
  3. var _sectionStringData = argument2;
  4. var subString = "";
  5. var p = 1;
  6. for (c = 1; c < string_length(_sectionStringData) + 1; c++)
  7. {
  8.     if (c mod 2 = 0)
  9.     {
  10.     p++
  11.     subString = string_char_at(_sectionStringData, c-1) + string_char_at(_sectionStringData, c)
  12.         switch(subString)
  13.         {
  14.             case "00":
  15.                 break;
  16.             case "":
  17.                 break;
  18.             case "01":
  19.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  20.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  21.                             "Walls",objWall)
  22.                             break;
  23.             case "02":
  24.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  25.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  26.                             "Walls",objBaddie1)
  27.                             break;
  28.             case "03":
  29.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  30.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  31.                             "Walls",objPlayerSpawn)
  32.                             break;
  33.             case "04":
  34.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  35.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  36.                             "Walls",objFence)
  37.                             break;
  38.             case "05":
  39.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  40.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  41.                             "Walls",objRock)
  42.                             break;
  43.             case "06":
  44.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  45.                             (_currentYSection * sectionHeight)+(floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  46.                             "Walls",objDecor1)
  47.                             break;
  48.             case "07":
  49.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  50.                             (_currentYSection * sectionHeight)+(floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  51.                             "Walls",objDecor2)
  52.                             break;
  53.             case "08":
  54.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  55.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  56.                             "Walls",objDecor3)
  57.                             break;
  58.             case "09":
  59.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  60.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  61.                             "Walls",objDecor4)
  62.                             break;
  63.             case "10":
  64.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  65.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  66.                             "Walls",objDecor5)
  67.                             break;
  68.             case "11":
  69.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  70.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  71.                             "Walls",objDecor6)
  72.                             break;
  73.             case "12":
  74.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  75.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  76.                             "Walls",objDecor7)
  77.                             break;
  78.             case "13":
  79.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  80.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  81.                             "Walls",objDecor8)
  82.                             break;
  83.             case "14":
  84.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  85.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  86.                             "Walls",objDecor9)
  87.                             break;
  88.             case "15":
  89.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  90.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  91.                             "Walls",objGoldenFence)
  92.                             break;
  93.             case "16":
  94.                 instance_create_layer((_currentXSection * sectionWidth) + (((p-1) mod sectionTilesX) * gridSize) +gridSize,
  95.                             (_currentYSection * sectionHeight)+ (floor((p-1)/sectionTilesX)* gridSize) +gridSize,
  96.                             "DivinePasture",objDivinePasture)
  97.                             break;
  98.            
  99.         }
  100.    
  101.     }
  102.     else
  103.         {
  104.         subString = ""
  105.         }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement