Epoch/Sources/epoch_code/gui/scripts/Epoch_dynamicText.sqf
vbawol 87c23b106f Release 0.3.8 (#502)
* first build for 0.3.8

* 0.3.8.0190

* 0.3.8.0202

* 0.3.8.0213

* 0.3.7.0214

* 0.3.8.0222

* 0.3.8.0246

* 0.3.8.0247

fixed typo

* 0.3.8.0249

more fixes for server compiler

* 0.3.8.0256

* add build number and simple batch file for packing

* match build number with internal

* add build numbers to server pbo's and mission files

also reworked build script for more options

* 0.3.8.0261

* 0.3.8.0261

* 0.3.8.0283

* 0.3.8.0284

* changelog

* 0.3.8.0307

* 0.3.8.0311

* remove old BEC plugin

* update redis-server.exe to latest build and full config

* 0.3.8.0314

* 0.3.8.0315

* inverse logic

This should correctly prevent spawning these units nearby jammer or
protection zones

* use pushbackUnique here

* optimized loot function

by using selectRandom instead of slower sqf logic

* 0.3.8.0316

* make use of new getDir functionality instead of BIS fnc

* add lower disconnect value to server.cfg

* use new getpos functionality

* 0.3.8.0317

* 0.3.8.0319

* 0.3.8.0327

* 0.3.8.0338

changelog update tba

* changelog

* 0.3.8.0341

* BE update

* 0.3.8.0353

* changelog

* removed duplicates

* 0.3.8.0355

fixed error in getIDC

* 0.3.8.0356

revert to BIS_fnc_param as params threw errors

* 0.3.8.0357

fixes for #496 #497

* 0.3.8.0359

fixed #497
fixed #496

* 0.3.8.0365

* 0.3.8.0371

* 0.3.8.0373

* 0.3.8.0379

* 0.3.8.0381

* 0.3.8.0386

* 0.3.8.0393

* 0.3.8.0395

* 0.3.8.0396

* 0.3.8.0397

* 0.3.8.0406

* 0.3.8.0409

* 0.3.8.0410

loot balance
suppress error in spawnloot
make near object check based on building size

* 0.3.8.0412

* 0.3.8.0414

removed classes with scope 0
test remove loot trash on gear for #498
fixed #501

* 0.3.8.0415

* same
2016-04-08 15:21:46 -05:00

113 lines
3.4 KiB
Plaintext

/*
Author: Raimonds Virtoss - EpochMod.com
Contributors: Aaron Clark
Description:
Displays custom text message to player
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/gui/scripts/Epoch_dynamicText.sqf
Usage:
"TEST" call Epoch_dynamicText
*/
#include "\A3\ui_f\hpp\defineCommonGrids.inc"
private ["_y","_cnt","_ctrl","_alreadyEnabled","_input","_scale","_width","_height","_centerX","_centerY","_display","_ctrlGroup","_controls","_ctrlText","_add"];
params [["_text","Missing text",["",(text "")]],["_time",5,[1]],["_color","#ffffff",[""]]];
if (_text isEqualType "STRING") then {_text = parseText _text};
_alreadyEnabled = uiNamespace getVariable ["rmx_var_dynamicText",false];
_input = count str _text * 2;
_scale = 1;
_width = _scale * GUI_GRID_W;
_height = _scale * GUI_GRID_H;
_centerX = 0.5;
_centerY = -18 * GUI_GRID_H + GUI_GRID_Y;
disableSerialization;
_display = findDisplay 46;
_ctrlGroup = _display ctrlCreate ["RscControlsGroupNoScrollbars", call Epoch_getIDC];
_ctrlGroup ctrlSetPosition [_centerX - _width/2 * _input / 2, _centerY - _height, _width * _input, _height * 2];
_ctrlGroup ctrlCommit 0;
_y = 0;
_cnt = -1;
_controls = [];
for "_i" from 0 to (_input - 1) do {
_ctrl = _display ctrlCreate ["RscPicture", call Epoch_getIDC,_ctrlGroup];
_cnt = _cnt + 1;
if (_cnt == (_input / 2)) then {_y = _height; _cnt = 0;};
_ctrl ctrlSetPosition [_cnt * _width,_y,_width,_height];
_ctrl ctrlSetText "#(rgb,8,8,3)color(1,1,1,1)";
_ctrl ctrlCommit 0;
_ctrl ctrlSetFade 1-(random 0.2);
[_ctrl, 1-(random 0.2),0] call BIS_fnc_ctrlSetScale;
_controls set [_i, _ctrl];
};
_ctrlText = _display ctrlCreate ["rmx_ST1", call Epoch_getIDC,_ctrlGroup];
_ctrlText ctrlSetStructuredText _text;
_ctrlText ctrlSetPosition [0, 0, _width * _input /2, _height * 2];
_ctrlText ctrlCommit 0;
_add = uiNamespace getVariable ["rmx_var_dynamicTextCTRL",[]];
_add pushBack _ctrlGroup;
uiNamespace setVariable ["rmx_var_dynamicTextCTRL",_add];
[_time,_ctrlGroup,_ctrlText,_controls] spawn {
disableSerialization;
params ["_time","_ctrlGroup","_ctrlText","_controls"];
_tick = diag_tickTime;
while {(diag_tickTime - _tick) < _time} do {
{
_x ctrlSetFade 1-(random 0.2);
[_x, 1-(random 0.2), (random 1)] call BIS_fnc_ctrlSetScale;
} forEach _controls;
uiSleep 0.5;
};
_arr = uiNamespace getVariable ["rmx_var_dynamicTextCTRL",[]];
_del =
{
if (str _x isEqualTo str _ctrlGroup) exitWith {_forEachIndex};
0
} forEach _arr;
_arr deleteAt _del;
uiNamespace setVariable ["rmx_var_dynamicTextCTRL",_arr];
uiSleep 0.01;
{
_x call Epoch_getIDC;
ctrlDelete _x;
} forEach (_controls + [_ctrlText] + [_ctrlGroup]);
};
if !(_alreadyEnabled) then {
uiNamespace setVariable ["rmx_var_dynamicText",true];
[ctrlPosition _ctrlGroup] spawn {
disableSerialization;
params ["_defaultPos"];
_yPos = _defaultPos param [1];
_height = _defaultPos param [3];
while {uiNamespace getVariable ["rmx_var_dynamicText",false]} do {
_arr = uiNamespace getVariable ["rmx_var_dynamicTextCTRL",[]];
if (_arr isEqualTo []) exitWith {uiNamespace setVariable ["rmx_var_dynamicText",nil];};
{
_xPos = (ctrlPosition _x) select 0;
_x ctrlSetPosition [_xPos,_yPos + _height * _forEachIndex];
_x ctrlCommit 0;
} forEach _arr;
};
};
};
true