Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.91 KB | None | 0 0
  1. waituntil {alive player};
  2.  
  3. GAIA_CACHE_STAGE_1 = 1200;
  4. publicvariable "GAIA_CACHE_STAGE_1";
  5.  
  6. if (isNil "tort_debug") then {tort_debug = false};
  7. if (!isNil "GAIA_dynamicCache") then {
  8.    if (!scriptDone GAIA_dynamicCache) then {
  9.       terminate GAIA_dynamicCache;
  10.       waitUntil {scriptDone GAIA_dynamicCache};
  11.    };
  12. };
  13.  
  14. _scriptname = "GAIA_dynamicCache";
  15. if (tolower(str(_this#0)) find "false" >= 0) exitWith {tort_tasks = tort_tasks - [_scriptname]; systemchat "GAIA_dynamicCache script terminated."};
  16. if (isnil "tort_tasks") then {tort_tasks = [_scriptname]} else {if !(_scriptname in tort_tasks) then {tort_tasks pushback _scriptname}};
  17.  
  18. GAIA_dynamicCache = _this spawn
  19. {
  20.    sleep (30 + random 10);
  21.    private _optimalFPS = param [0, 50];
  22.    private _seconds    = param [1, 30]; _seconds = 5 max (_seconds - random(_seconds*0.1) + random(_seconds*0.1));
  23.    private _GAIAmin    = 500;
  24.    private _GAIAmax    = 2000;
  25.    private _actionCounter = 0;
  26.    private _subseqActions = 4;
  27.    private _sleep = _seconds;
  28.  
  29.    while {alive player} do
  30.    {
  31.       _fps = 0; for "_i" from 1 to 10 do {_fps = _fps + diag_fps; sleep 0.5}; _fps = 0.1*_fps;
  32.       if ((_fps < (0.75 * _optimalFPS)) && (_actionCounter < _subseqActions)) then
  33.       {
  34.         GAIA_CACHE_STAGE_1 = _GAIAmin max (GAIA_CACHE_STAGE_1 - 100);
  35.          _sleep = 0.8 * _seconds;
  36.          _actionCounter = _actionCounter + 1;
  37.       };
  38.       if ((_fps > _optimalFPS) && (_actionCounter < _subseqActions)) then
  39.       {
  40.         GAIA_CACHE_STAGE_1 = _GAIAmax min (GAIA_CACHE_STAGE_1 + 100);
  41.          _sleep = 1.3 * _seconds;
  42.          _actionCounter = _actionCounter + 1;
  43.       };
  44.       if (_actionCounter >= _subseqActions) then {_sleep = _seconds; _actionCounter = 0};
  45.       systemchat format ["_fps:%1, _sleep:%2, CACHE:%3, _atn:%4",_fps,_sleep,GAIA_CACHE_STAGE_1,_actionCounter];
  46.       sleep (_sleep - 5);
  47.    };
  48. };
  49.  
  50. tort_tasks = tort_tasks - [_scriptname];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement