Started command system

This commit is contained in:
Benjamin Kyd
2019-06-07 20:22:19 +01:00
parent c8014ec81e
commit db62fbcc42
4 changed files with 40 additions and 1 deletions

View File

@@ -195,6 +195,7 @@ class Life_Client_Core {
class inventoryOpened {};
class isUIDActive {};
class keyHandler {};
class commandHandler {};
class loadDeadGear {};
class loadGear {};
class nearATM {};

View File

@@ -10,7 +10,6 @@ private ["_value","_action"];
if (FETCH_CONST(life_adminlevel) < 2) exitWith {closeDialog 0; hint localize "STR_ANOTF_ErrorLevel";};
_value = parseNumber(ctrlText 9922);
if (_value < 0) exitWith {};
if (_value > 999999) exitWith {hint localize "STR_ANOTF_Fail"};
_action = [
format [localize "STR_ANOTF_CompWarn",[_value] call life_fnc_numberText],

View File

@@ -0,0 +1,24 @@
// Messy and mostly stolen code
systemChat "Chat Key pressed";
// If the key pressed in the chat bar was not enter, move on
if ((_this select 1) != 28) exitWith {false};
systemChat "Enter Pressed";
private _chatmsg = ctrlText (finddisplay 24 displayctrl 101);
if ("/" != (_chatmsg select [0,1])) exitWith { };
systemChat _chatmsg;
(finddisplay 24 displayctrl 101) ctrlSetText "";
// closeDialog 0;
// (findDisplay 24) closeDisplay 1;
private _command = (_chatmsg splitString "/");
private _args = (_command splitString " ");
systemChat _command select 0;
hint format ["%1", _args];
(findDisplay 24) displayRemoveEventHandler ["KeyDown", chatCommandEventH];

View File

@@ -54,6 +54,21 @@ if (life_container_active) then {
true;
};
// Chat commands
if (inputAction "Chat" > 0) then
{
systemChat "Chat Opened";
chatCommandSpawn = [] spawn
{
systemChat "Spawned event handler";
waitUntil {shownChat};
waitUntil {!isNull (finddisplay 24 displayctrl 101)};
chatCommandEventH = (findDisplay 24) displayAddEventHandler["KeyDown","_this call life_fnc_commandHandler"];
};
};
switch (_code) do {
// -- Disable commander/tactical view
if (LIFE_SETTINGS(getNumber,"disableCommanderView") isEqualTo 1) then {