daily pastebin goal
56%
SHARE
TWEET

SoldierEPilot - read.sqf

Faguss Mar 11th, 2015 (edited) 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private "_find";
  2. print = "hintc Format [""%1"", _this]";
  3.  
  4. if (Format ["%1", getWorld] == "scalar bool array string 0xfcffffef") then
  5. {
  6.         // OFP
  7.         _find =
  8.         {
  9.                 private ["_c", "_i"];
  10.                 _c = count (_this select 0);
  11.                 _i = 0;
  12.                
  13.                 while "_i < _c" do
  14.                 {
  15.                         if ((_this select 1) == ((_this select 0) select _i)) then {_c=-1} else {_i=_i+1};
  16.                 };
  17.                
  18.                 if (_c < 0) then {_i} else {-1}
  19.         };
  20. }
  21. else
  22. {
  23.         //CWA
  24.         _find = "(_this select 0) find (_this select 1)";
  25. };
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. /*
  33. STRUCTURE OF "_ALL" ARRAY:
  34. 0 - [start weather, start fog, forecast weather, forecast fog];
  35. 1 - array of all available groups;
  36. 2 - empty vehicles placed;
  37. 3 - all placed triggers;
  38. 4 - all placed markers
  39. */
  40.  
  41. private ["_ALL", "_a", "_cmp", "_cmpgs", "_c", "_j", "_p", "_f", "_msnPath", "_il", "_token"];
  42. _ALL = [];
  43. _ALl resize 5;
  44.  
  45.  
  46. // Safe wrapper for "... :il ..." request
  47. // Need in other places, not here
  48. _il =
  49. {
  50.         private ["_p", "_r"];
  51.         if (_this in [_this]) then {_p=[_this]} else {_p=+_this};
  52.         _r = ["il "];
  53.         "_r=_r+[Format[""%1"",_x]]" forEach _p;
  54.         call (_r call FLIB_EXEC)
  55. };
  56.  
  57.  
  58. // Safe wrapper for "... :class token ..." request
  59. _msnPath = _this;
  60. _token =
  61. {
  62.         private ["_t", "_r"];
  63.         if (_this in [_this]) then {_t=[_this]} else {_t=+_this};
  64.         _r = ["class token ", """", "f:", _msnPath, """", " "];
  65.         "_r=_r+[Format[""%1"",_x]]" forEach _t;
  66.  
  67.         //player sideChat Format ["%1", _r];
  68.         call (_r call FLIB_EXEC)
  69. };
  70.  
  71.  
  72.  
  73.  
  74. // Get weather info as a 4-element vector:
  75. // [start cast, start fog, forecast weather, forecast fog]
  76. private ["_w", "_i"];
  77. _w = [];
  78. _ALL set [0, "впартапапва"];
  79. //_msnPath call print;
  80.  
  81. // Critical error here
  82. _a = "c:[Mission,Intel]" call _token;
  83. _i = [_a select 6, "startWeather"] call _find;
  84. if (_i<0) then {_w set [0, 0.5]} else {_w set [0, call ((_a select 7) select _i)]};
  85.  
  86. _i= [_a select 6, "startFog"] call _find;
  87. if (_i<0) then {_w set [1, 0]} else {_w set [1, call ((_a select 7) select _i)]};
  88.  
  89. _i= [_a select 6, "forecastWeather"] call _find;
  90. if (_i<0) then {_w set [2, 0.5]} else {_w set [2, call ((_a select 7) select _i)]};
  91.  
  92. _i= [_a select 6, "forecastFog"] call _find;
  93. if (_i<0) then {_w set [3, 0]} else {_w set [3, call ((_a select 7) select _i)]};
  94.  
  95. _ALL set [0, +_w];
  96.  
  97.  
  98.  
  99.  
  100. // Get array of all groups on the map
  101. private ["_g","_sh","_n","_v","_o","_m"];
  102. _g = [];
  103. _a = "c:[Mission,Groups]" call _token;
  104.  
  105. _sh = call (_a select 5);
  106. _N = call ((_a select 7) select 0);
  107. _i = -1;
  108.  
  109. while "_i=_i+1; _i<_N" do
  110. {
  111.         _M = (["c:[Mission,Groups,Item", _i, ",Vehicles"] call _token) select 7;
  112.         _M = call (_M select 0);
  113.        
  114.         _j = -1;
  115.         while "_j=_j+1; _j<_M" do
  116.         {
  117.                 _a = ["c:[Mission,Groups,Item", _i, ",Vehicles,Item", _j, "] ", _sh] call _token;
  118.                 _sh = call (_a select 5);
  119.                 _p = (_a select 7) select ([_a select 6, "position[]"] call _find);
  120.                 _v = (_a select 7) select ([_a select 6, "vehicle"] call _find);
  121.                 _o = nearestObject [  [call (_p select 0),call (_p select 2)], call _v  ];
  122.                
  123.                 if (! isNull _o) then
  124.                 {
  125.                         _g = _g + [group _o];
  126.                         _j = _M;
  127.                 };
  128.         };
  129. };
  130. _ALL set [1, +_g];
  131.  
  132.  
  133.  
  134.  
  135.  
  136. // Get array of all empty vehicles on the map
  137. private ["_e"];
  138. _e = [];
  139. _a = "c:[Mission,Vehicles]" call _token;
  140. _sh = call (_a select 5);
  141. _N = call((_a select 7) select 0);
  142. _i = -1;
  143.  
  144. while "_i=_i+1; _i<_N" do
  145. {
  146.         _a = ["c:[Mission,Vehicles,Item", _i, "] ", _sh] call _token;
  147.         _sh = call (_a select 5);
  148.         _p = (_a select 7) select ([_a select 6, "position[]"] call _find);
  149.         _v = (_a select 7) select ([_a select 6, "vehicle"] call _find);
  150.         _e = _e + [nearestObject [  [call (_p select 0),call (_p select 2)], call _v]  ];
  151. };
  152.  
  153. _ALL set [2, +_e];
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160. // Get array of all mission triggers
  161. private ["_t"];
  162. _t = [];
  163. _a = "c:[Mission,Sensors]" call _token;
  164. _sh = call (_a select 5);
  165. _N = call ((_a select 7) select 0);
  166. _i = -1;
  167.  
  168. while "_i=_i+1; _i<_N" do
  169. {
  170.         _a = ["c:[Mission,Sensors,Item", _i, "] ", _sh] call _token;
  171.         _sh = call (_a select 5);
  172.         _p = (_a select 7) select ([_a select 6, "position[]"] call _find);
  173.         _t = _t + [  nearestObject [[call (_p select 0),call (_p select 2)], "EmptyDetector"]  ];
  174. };
  175.  
  176. _ALL set [3, +_t];
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184. // Array of all mission markers
  185. _m = [];
  186. _a = "c:[Mission,Markers]" call _token;
  187. _sh = call (_a select 5);
  188. _N = call ((_a select 7) select 0);
  189. _i = -1;
  190.  
  191. while "_i=_i+1; _i<_N" do
  192. {
  193.         _a = ["c:[Mission,Markers,Item", _i, "] ", _sh] call _token;
  194.         _sh = call (_a select 5);
  195.         _m = _m + [  call ((_a select 7) select ([_a select 6, "name"] call _find))  ];
  196. };
  197.  
  198. _ALL set [4, +_m];
  199.  
  200.  
  201.  
  202.  
  203. _ALL
RAW Paste Data
Top