Advertisement
the_eraser1

Untitled

Jul 5th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.98 KB | None | 0 0
  1. /*
  2. @file Version: 0.2
  3. @file Name: statusBar.sqf
  4. @file EpochMod StatusBar Port for Wasteland / Exile by CRE4MPIE
  5. @file Created: 21/4/2015
  6. @file Updated by CRE4MPIE for new Exile Attributes
  7. @File Edited 15/3/2016
  8. @notes: Added custom Icons and Attributes, removed garbage
  9. All Credits Due to the original creator of this script.
  10. */
  11. waitUntil {!(isNull (findDisplay 46))};
  12. disableSerialization;
  13.  
  14. [] spawn
  15. {
  16. _uid = getPlayerUID player;
  17.  
  18. [5,
  19. {
  20. _rscLayer = "RscStatusBar" call BIS_fnc_rscLayer;
  21. _rscLayer cutRsc ["RscStatusBar","PLAIN",1,false];
  22.  
  23. if(isNull ((uiNamespace getVariable "RscStatusBar")displayCtrl 55554)) then
  24. {
  25. diag_log "statusbar is null create";
  26. disableSerialization;
  27. _rscLayer = "RscStatusBar" call BIS_fnc_rscLayer;
  28. _rscLayer cutRsc ["RscStatusBar","PLAIN",1,false];
  29. };
  30. //initialize variables and set values
  31. _unit = _this select 0;
  32. _damage = round ((1 - (damage player)) * 100);
  33. //_damage = (round(_damage * 100));
  34. _hunger = round (ExileClientPlayerAttributes select 2);
  35. _thirst = round (ExileClientPlayerAttributes select 3);
  36. _bodytemp = round (ExileClientPlayerAttributes select 5);
  37. _ambient = [ExileClientEnvironmentTemperature, 1] call ExileClient_util_math_round;
  38. _wallet = player getVariable ["ExileMoney", 0];
  39. _locker = player getVariable ["ExileLocker", 0];
  40. _respect = ExileClientPlayerScore;
  41. _serverFPS = round diag_fps;
  42. _pos = getPosATL player;
  43. _dir = round (getDir (vehicle player));
  44. _grid = mapGridPosition player; _xx = (format[_grid]) select [0,3];
  45. _yy = (format[_grid]) select [3,3];
  46. _time = (round(180-(serverTime)/60)); //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals
  47. _hours = (floor(_time/60));
  48. _minutes = (_time - (_hours * 60));
  49.  
  50. switch(_minutes) do
  51. {
  52. case 9: {_minutes = "09"};
  53. case 8: {_minutes = "08"};
  54. case 7: {_minutes = "07"};
  55. case 6: {_minutes = "06"};
  56. case 5: {_minutes = "05"};
  57. case 4: {_minutes = "04"};
  58. case 3: {_minutes = "03"};
  59. case 2: {_minutes = "02"};
  60. case 1: {_minutes = "01"};
  61. case 0: {_minutes = "00"};
  62. };
  63.  
  64. //Color Gradient
  65. _colourDefault = parseText "#FBFCFE"; //
  66. _colour90 = parseText "#F5E6EC"; //
  67. _colour80 = parseText "#F0D1DB"; //
  68. _colour70 = parseText "#EBBBC9"; //
  69. _colour60 = parseText "#E6A6B8"; //
  70. _colour50 = parseText "#E191A7"; //
  71. _colour40 = parseText "#DB7B95"; //
  72. _colour30 = parseText "#D66684"; //
  73. _colour20 = parseText "#D15072"; //
  74. _colour10 = parseText "#CC3B61"; //
  75. _colour0 = parseText "#C72650"; //
  76. _colourDead = parseText "#000000";
  77.  
  78. //Colour coding
  79. //Damage
  80. _colourDamage = _colourDefault;
  81. if(_damage >= 100) then{_colourDamage = _colourDefault;};
  82. if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;};
  83. if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;};
  84. if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;};
  85. if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;};
  86. if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;};
  87. if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;};
  88. if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;};
  89. if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;};
  90. if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;};
  91. if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;};
  92. if(_damage < 1) then{_colourDamage = _colourDead;};
  93.  
  94. //Hunger
  95. _colourHunger = _colourDefault;
  96. if(_hunger >= 100) then{_colourHunger = _colourDefault;};
  97. if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;};
  98. if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;};
  99. if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;};
  100. if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;};
  101. if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;};
  102. if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;};
  103. if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;};
  104. if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;};
  105. if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;};
  106. if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;};
  107. if(_hunger < 1) then{_colourHunger = _colourDead;};
  108.  
  109.  
  110. //Thirst
  111. _colourThirst = _colourDefault;
  112. switch true do
  113. {
  114. case(_thirst >= 100) : {_colourThirst = _colourDefault;};
  115. case((_thirst >= 90) && (_thirst < 100)) : {_colourThirst = _colour90;};
  116. case((_thirst >= 80) && (_thirst < 90)) : {_colourThirst = _colour80;};
  117. case((_thirst >= 70) && (_thirst < 80)) : {_colourThirst = _colour70;};
  118. case((_thirst >= 60) && (_thirst < 70)) : {_colourThirst = _colour60;};
  119. case((_thirst >= 50) && (_thirst < 60)) : {_colourThirst = _colour50;};
  120. case((_thirst >= 40) && (_thirst < 50)) : {_colourThirst = _colour40;};
  121. case((_thirst >= 30) && (_thirst < 40)) : {_colourThirst = _colour30;};
  122. case((_thirst >= 20) && (_thirst < 30)) : {_colourThirst = _colour20;};
  123. case((_thirst >= 10) && (_thirst < 20)) : {_colourThirst = _colour10;};
  124. case((_thirst >= 1) && (_thirst < 10)) : {_colourThirst = _colour0;};
  125. case(_thirst < 1) : {_colourThirst = _colourDead;};
  126. };
  127.  
  128.  
  129. //Thirst
  130. _colourCold = _colourDefault;
  131. switch true do
  132. {
  133. case(_bodytemp >= 37) : {_colourCold = _colourDefault;};
  134. case((_bodytemp >= 37) && (_bodytemp < 38)) : {_colourCold = _colour90;};
  135. case((_bodytemp >= 36) && (_bodytemp < 37)) : {_colourCold = _colour80;};
  136. case((_bodytemp >= 35) && (_bodytemp < 36)) : {_colourCold = _colour70;};
  137. case((_bodytemp >= 34) && (_bodytemp < 35)) : {_colourCold = _colour60;};
  138. case((_bodytemp >= 34) && (_bodytemp < 35)) : {_colourCold = _colour50;};
  139. case((_bodytemp >= 33) && (_bodytemp < 34)) : {_colourCold = _colour40;};
  140. case((_bodytemp >= 33) && (_bodytemp < 34)) : {_colourCold = _colour30;};
  141. case((_bodytemp >= 32) && (_bodytemp < 33)) : {_colourCold = _colour20;};
  142. case((_bodytemp >= 31) && (_bodytemp < 32)) : {_colourCold = _colour10;};
  143. case((_bodytemp >= 1) && (_bodytemp < 10)) : {_colourCold = _colour0;};
  144. case(_bodytemp < 1) : {_colourCold = _colourDead;};
  145. };
  146.  
  147.  
  148. //display the information
  149. ((uiNamespace getVariable "RscStatusBar")displayCtrl 55554) ctrlSetStructuredText
  150. parseText
  151. format
  152. ["
  153. <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0' shadowColor='#000000' image='custom\statusbar\icons\players.paa' color='%9'/> %2</t>
  154. <t shadow='1' shadowColor='#000000' color='%14'><img size='1.0' shadowColor='#000000' image='custom\statusbar\icons\health.paa' color='%9'/> %3%1</t>
  155. <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0' shadowColor='#000000' image='custom\statusbar\icons\poptabs.paa' color='%9'/> %4</t>
  156. <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0' shadowColor='#000000' image='custom\statusbar\icons\locker.paa' color='%9'/> %21</t>
  157. <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0' shadowColor='#000000' image='custom\statusbar\icons\respect.paa' color='%9'/> %8</t>
  158. <t shadow='1' shadowColor='#000000' color='%9'>FPS: %7</t>
  159. <t shadow='1' shadowColor='#000000' color='%9'><img size='1.6' shadowColor='#000000' image='custom\statusbar\icons\restart.paa' color='%9'/>%12:%13</t>",
  160.  
  161. "%",
  162. count playableUnits,
  163. _damage,
  164. _wallet,
  165. _hunger,
  166. _thirst,
  167. _serverFPS,
  168. _respect,
  169. _colourDefault,
  170. format["%1/%2",_xx,_yy],
  171. _dir,
  172. _hours,
  173. _minutes,
  174. _colourDamage,
  175. _colourHunger,
  176. _colourThirst,
  177. _colourCold,
  178. _ambient,
  179. _bodytemp,
  180. "°C",
  181. _locker
  182. ];
  183. }, [], true] call ExileClient_system_thread_addTask;
  184. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement