Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p2GoldFlashing = nil;
- p2GoldRunTime = nil;
- fnc_p2flashGold = {
- private["_in","_rt","_cl","_am"];
- disableSerialization;
- _in = nil;
- _rt = 1.5;
- _in = _this;
- if (isNil '_in') exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
- if (typeName _in != "ARRAY") exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
- _cl = _in select 0;
- _am = _in select 1;
- if (typeName _cl != "BOOL") exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
- if (typeName _am != "SCALAR") exitWith {p2GoldFlashing = nil; p2GoldRunTime = nil;};
- if (isNil 'p2GoldFlashing') then { if (_cl) then { p2GoldFlashing = false; } else { p2GoldFlashing = true }; };
- if (isNil 'p2GoldRunTime') then { p2GoldRunTime = (_rt * 2) };
- if (str p2GoldFlashing == str _cl) then {
- if (!isNil 'p2GF_R') then { terminate p2GF_R }; if (!isNil 'p2GF_G') then { terminate p2GF_G };
- } else {
- uiSleep (_rt / 2);
- if (!isNil 'p2GF_R') then { terminate p2GF_R }; if (!isNil 'p2GF_G') then { terminate p2GF_G };
- if (isNil 'p2GoldRunTime') then { p2GoldRunTime = (_rt * 2) };
- if (isNil 'p2GoldFlashing') then { if (_cl) then { p2GoldFlashing = false; } else { p2GoldFlashing = true }; };
- };
- p2GoldFlashing = _cl;
- if (_cl) then {
- p2GF_R = [_rt,_am] spawn {
- private["_rt","_am","_tx"];
- _rt = _this select 0;
- _am = _this select 1;
- for "_i" from 0 to p2GoldRunTime do {
- _tx = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
- for "_j" from 1 to 10 do {
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>" + str _am + "</t>");
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [1,0,0,1];
- uiSleep 0.01;
- };
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>" + _tx + "</t>");
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [0.8784,0.8471,0.651,1];
- uiSleep 0.40;
- };
- p2GoldFlashing = nil;
- p2GoldRunTime = nil;
- };
- } else {
- p2GF_G = [_rt,_am] spawn {
- private["_rt","_am","_tx"];
- _rt = _this select 0;
- _am = _this select 1;
- for "_i" from 0 to p2GoldRunTime do {
- _tx = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
- for "_j" from 1 to 10 do {
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>+" + str _am + "</t>");
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [0,1,0,1];
- uiSleep 0.01;
- };
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetStructuredText parseText("<t align='right'>" + _tx + "</t>");
- ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290) ctrlSetTextColor [0.8784,0.8471,0.651,1];
- uiSleep 0.40;
- };
- p2GoldFlashing = nil;
- p2GoldRunTime = nil;
- };
- };
- };
- [] spawn {
- private["_p2o","_p2on","_p2n","_p2nn","_p2pm","_di"];
- disableSerialization;
- while {true} do {
- _di = uiNamespace getVariable 'p2GoldUI';
- if (!isNil "_di") then {
- if (isNil 'p2GoldFlashing') then {
- _p2o = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
- uiSleep 0.0333;
- _p2n = ctrlText ((uiNamespace getVariable 'p2GoldUI') displayCtrl 8290);
- if (_p2o != _p2n) then {
- _p2on = parseNumber _p2o;
- _p2nn = parseNumber _p2n;
- _p2pm = 0;
- if (_p2on < _p2nn) then {
- _p2pm = _p2nn - _p2on;
- diag_log(format["%1 < %2 ... %3",_p2on,_p2nn,_p2pm]);
- } else {
- _p2pm = _p2nn - _p2on;
- diag_log(format["%1 > %2 ... %3",_p2on,_p2nn,_p2pm]);
- };
- if (_p2pm < 0) then {
- [true,_p2pm] call fnc_p2flashGold;
- } else {
- [false,_p2pm] call fnc_p2flashGold;
- };
- };
- };
- };
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment