Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $$<modular.inputs.min.txt>
  2.  
  3.     LOG("§e'§3Service sensors§e' §6started §7%&inputs_[1]% §7%&inputs_[2]% §7%&inputs_[3]% §7%&inputs_[4]% §7%&inputs_[5]% §7%&inputs_[6]% §7%&inputs_[7]% §7%&inputs_[8]%");
  4.     &current_="sensors.init";
  5.  
  6.     //12 lines of horizontal sensors. Each line has 7 sensors.
  7.     //0-2: back positions. 3: current position. 4-6 front positions
  8.     //4 groups of sensor lines: floor(f){y=-1}, surface(s){y=0}, head(h){y=1}, roof(r){y=2}
  9.     //3 horizontal lines of sensor lines: left(l), center(c), right(r)
  10.     //Pattern example variable name: sensorls[3] (left surface at the current block)
  11.  
  12. $$<modular.initial.min.txt>
  13.  
  14.     //§
  15.     ELSEIF(&current_=="sensors.init");
  16.         SET(@service_sensors);
  17.         &next_="sensors.monitor";
  18.  
  19.     ELSEIF(&current_=="sensors.monitor");
  20.         UNSAFE(350);
  21.             DO;
  22.  
  23.                 IF(%DIRECTION%=="N");
  24.                     #x=0;#z=-1;
  25.                     //left: -x, right:+x          
  26.                 ELSEIF(%DIRECTION%=="S");
  27.                     #x=0;#z=1;
  28.                     //left: +x, right:-x
  29.                 ELSEIF(%DIRECTION%=="E");
  30.                     #x=1;#z=0;
  31.                     //left: -z, right:+z
  32.                 ELSEIF(%DIRECTION%=="W");
  33.                     #x=-1;#z=0;
  34.                     //left: +z, right:-z
  35.                 ENDIF;
  36.  
  37.                 #leftx=%#z%*1;#rightx=%#z%*-1;
  38.                 #leftz=%#x%*-1;#rightz=%#x%*1;
  39.  
  40.                 FOR(#n,-3,3);
  41.  
  42.                     #nx=%#x%*%#n%;#nz=%#z%*%#n%;#apos=3+%#n%;
  43.                     #nleftx=%#nx%+%#leftx%;#nleftz=%#nz%+%#leftz%;
  44.                     #nrightx=%#nx%+%#rightx%;#nrightz=%#nz%+%#rightz%;
  45.  
  46.                     ///////////////////////////////////
  47.                     //           FLOOR
  48.                     ///////////////////////////////////
  49.                     #gy=-1;
  50.                     GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
  51.                     GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
  52.                     GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
  53.                     MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
  54.                     MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
  55.                     SET(@&sensorcf[%#apos%],"%&id[1]%:%&data[1]%");
  56.                     SET(@&sensorlf[%#apos%],"%&id[2]%:%&data[2]%");
  57.                     SET(@&sensorrf[%#apos%],"%&id[3]%:%&data[3]%");
  58.  
  59.                     ///////////////////////////////////
  60.                     //           SURFACE
  61.                     ///////////////////////////////////
  62.                     #gy=0;
  63.                     GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
  64.                     GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
  65.                     GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
  66.                     MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
  67.                     MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
  68.                     SET(@&sensorcs[%#apos%],"%&id[1]%:%&data[1]%");
  69.                     SET(@&sensorls[%#apos%],"%&id[2]%:%&data[2]%");
  70.                     SET(@&sensorrs[%#apos%],"%&id[3]%:%&data[3]%");
  71.  
  72.                     ///////////////////////////////////
  73.                     //           HEAD
  74.                     ///////////////////////////////////
  75.                     #gy=1;
  76.                     GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
  77.                     GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
  78.                     GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
  79.                     MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
  80.                     MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
  81.                     SET(@&sensorch[%#apos%],"%&id[1]%:%&data[1]%");
  82.                     SET(@&sensorlh[%#apos%],"%&id[2]%:%&data[2]%");
  83.                     SET(@&sensorrh[%#apos%],"%&id[3]%:%&data[3]%");
  84.  
  85.                     ///////////////////////////////////
  86.                     //           ROOF
  87.                     ///////////////////////////////////
  88.                     #gy=2;
  89.                     GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
  90.                     GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
  91.                     GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
  92.                     MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
  93.                     MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
  94.                     SET(@&sensorcr[%#apos%],"%&id[1]%:%&data[1]%");
  95.                     SET(@&sensorlr[%#apos%],"%&id[2]%:%&data[2]%");
  96.                     SET(@&sensorrr[%#apos%],"%&id[3]%:%&data[3]%");
  97.  
  98.                 NEXT;
  99.              
  100.                 $$<modular.loop.min.txt>
  101.  
  102.             WHILE(1);
  103.  
  104.             UNSET(@service_sensors);
  105.             UNSET(%&socket_%);
  106.  
  107.             ARRAYSIZE(@&sensorcf,#s);
  108.             IF(#s>0);
  109.                 DO(%#s%);
  110.                     POP(@&sensorcf,&o);
  111.                     POP(@&sensorlf,&o);
  112.                     POP(@&sensorrf,&o);
  113.                     POP(@&sensorcs,&o);
  114.                     POP(@&sensorls,&o);
  115.                     POP(@&sensorrs,&o);
  116.                     POP(@&sensorch,&o);
  117.                     POP(@&sensorlh,&o);
  118.                     POP(@&sensorrh,&o);
  119.                     POP(@&sensorcr,&o);
  120.                     POP(@&sensorlr,&o);
  121.                     POP(@&sensorrr,&o);
  122.                 LOOP;
  123.             ENDIF;
  124.  
  125.         ENDUNSAFE;
  126.  
  127.         &next_="exit";
  128.  
  129. $$<modular.parser.min.txt>
  130.  
  131.     LOG("§e'§3Service Sensors§e' §cScript stopped!");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement