Advertisement
TBsThug

statusBar.sqf

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