Jump to content

[RELEASE] Custom GUI / Menu UPDATED for 1061


theduke

Recommended Posts

try with this file menu_init.sqf :

Spoiler

disableSerialization;
///////////////////
//////Config//////
/////////////////

_serverName = "Name"; // the server name that will go accross the top of the menu

_ts3IP = "TS3"; // ts3 ip that will go at the bottom of the menu

_websiteUrl = "Web"; // website url that goes at the bottom of the menu 


////////////////////////////////////////////
////////////////////ACTIONS////////////////
//////////////////////////////////////////

_action1Text = "Suicide"; //Text that will go on action button 1
action1script = {((ctrlParent (_this select 0)) closeDisplay 7777); execvm 'custom\menu\scripts\suicide.sqf';}; //script that action button 1 will use

_action2Text = ""; //Text that will go on action button 2
action2script = {}; //script that action button 2 will use

_info1Text = "Rules"; //Text that will go on info button 1
info1script = {((ctrlParent (_this select 0)) closeDisplay 7777); execvm 'custom\menu\rules_init.sqf';}; //script that info button 1 will use

_info2Text = "Features and Tips"; //Text that will go on info button 2
info2script = {((ctrlParent (_this select 0)) closeDisplay 7777); createDialog "info2";}; //script that info button 2 will use

_info3Text = "Latest Updates"; //Text that will go on info button 3
info3script = {((ctrlParent (_this select 0)) closeDisplay 7777); createDialog "info3";}; //script that action info 3 will use

_info4Text = ""; //Text that will go on info button 4
info4script = {}; //script that action info 4 will use


///////////////////////////////////////////////
//////////////DEPLOYABLES/////////////////////
/////////////////////////////////////////////


_deployable1Text = "Bike"; //Text that will go on deployable button 1
_deploy1item1Text = "ToolBox"; //Text that will go in the number 1 item slot under the first deploy button 
_deploy1item2Text = ""; //Text that will go in the number 2 item slot under the first deploy button 
_deploy1item3Text = ""; //Text that will go in the number 3 item slot under the first deploy button 
_deploy1item4Text = ""; //Text that will go in the number 4 item slot under the first deploy button 
_deploy1item5Text = ""; //Text that will go in the number 5 item slot under the first deploy button 
deployable1script = {((ctrlParent (_this select 0)) closeDisplay 7777), 0 execVM 'scripts\deployAnything\deploy.sqf';};

_deployable2Text = "Mozzie"; //Text that will go on deployable button 2
_deploy2item1Text = "ToolBox"; //Text that will go in the number 1 item slot under the Second deploy button 
_deploy2item2Text = "Engine"; //Text that will go in the number 2 item slot under the Second deploy button 
_deploy2item3Text = "Main Rotor"; //Text that will go in the number 3 item slot under the Second deploy button 
_deploy2item4Text = "Scrap Metal"; //Text that will go in the number 4 item slot under the Second deploy button 
_deploy2item5Text = "Jerry Can (filled)"; //Text that will go in the number 5 item slot under the Second deploy button 
deployable2script = {((ctrlParent (_this select 0)) closeDisplay 7777), 1 execVM 'scripts\deployAnything\deploy.sqf';};

_deployable3Text = "Virtual Garage"; //Text that will go on deployable button 3
_deploy3item1Text = "ToolBox"; //Text that will go in the number 1 item slot under the third deploy button 
_deploy3item2Text = "Sapphire"; //Text that will go in the number 2 item slot under the third deploy button 
_deploy3item3Text = "Ruby"; //Text that will go in the number 3 item slot under the third deploy button 
_deploy3item4Text = ""; //Text that will go in the number 4 item slot under the third deploy button 
_deploy3item5Text = ""; //Text that will go in the number 5 item slot under the third deploy button 
deployable3script = {((ctrlParent (_this select 0)) closeDisplay 7777), 2 execVM 'scripts\deployAnything\deploy.sqf';};



createDialog "menu";


////////////////////////////////
//DO NOT EDIT BELLOW THIS LINE//
////////////////////////////////
fnc_update_all_text = {
_finddialog = findDisplay 7777;
(_finddialog displayCtrl 1609) ctrlSetText format["%1",_action1Text];
(_finddialog displayCtrl 1611) ctrlSetText format["%1",_info1Text];
(_finddialog displayCtrl 1612) ctrlSetText format["%1",_info2Text];
(_finddialog displayCtrl 1613) ctrlSetText format["%1",_info3Text];
(_finddialog displayCtrl 1614) ctrlSetText format["%1",_deployable1Text];
(_finddialog displayCtrl 1615) ctrlSetText format["%1",_deployable2Text];
(_finddialog displayCtrl 1616) ctrlSetText format["%1",_deployable3Text];
(_finddialog displayCtrl 1007) ctrlSetText format["%1",_deploy1item1Text];
(_finddialog displayCtrl 1008) ctrlSetText format["%1",_deploy1item2Text];
(_finddialog displayCtrl 1009) ctrlSetText format["%1",_deploy1item3Text];
(_finddialog displayCtrl 1010) ctrlSetText format["%1",_deploy1item4Text];
(_finddialog displayCtrl 1011) ctrlSetText format["%1",_deploy1item5Text];
(_finddialog displayCtrl 1012) ctrlSetText format["%1",_deploy2item1Text];
(_finddialog displayCtrl 1013) ctrlSetText format["%1",_deploy2item2Text];
(_finddialog displayCtrl 1014) ctrlSetText format["%1",_deploy2item3Text];
(_finddialog displayCtrl 1015) ctrlSetText format["%1",_deploy2item4Text];
(_finddialog displayCtrl 1016) ctrlSetText format["%1",_deploy2item5Text];
(_finddialog displayCtrl 1017) ctrlSetText format["%1",_deploy3item1Text];
(_finddialog displayCtrl 1018) ctrlSetText format["%1",_deploy3item2Text];
(_finddialog displayCtrl 1019) ctrlSetText format["%1",_deploy3item3Text];
(_finddialog displayCtrl 1020) ctrlSetText format["%1",_deploy3item4Text];
(_finddialog displayCtrl 1021) ctrlSetText format["%1",_deploy3item5Text]; 
(_finddialog displayCtrl 1001) ctrlSetText format["%1",_websiteUrl];
(_finddialog displayCtrl 1002) ctrlSetText format["%1",_ts3IP];
(_finddialog displayCtrl 10003) ctrlSetText format["%1",_ts3IP];
(_finddialog displayCtrl 1000) ctrlSetText format["%1 Menu",_serverName];
};

call fnc_update_all_text;

//(_finddialog displayCtrl 1610) ctrlSetText format["%1",_action2Text];
//(_finddialog displayCtrl 1618) ctrlSetText format["%1",_info4Text];

 

 

Link to comment
Share on other sites

Thank you very much, now it works!

I had to replace 

deployable1script = {((ctrlParent (_this select 0)) closeDisplay 7777), [0] execVM 'scripts\deployAnything\deploy.sqf';};

with

deployable1script = {((ctrlParent (_this select 0)) closeDisplay 7777), 0 execVM 'scripts\deployAnything\deploy.sqf';};

 

Link to comment
Share on other sites

17 minutes ago, kmiller said:

Thank you very much, now it works!

I had to replace 


deployable1script = {((ctrlParent (_this select 0)) closeDisplay 7777), [0] execVM 'scripts\deployAnything\deploy.sqf';};

with


deployable1script = {((ctrlParent (_this select 0)) closeDisplay 7777), 0 execVM 'scripts\deployAnything\deploy.sqf';};

 

:wink:

Link to comment
Share on other sites

  • 9 months later...

Hi, I know I most likely done something wrong, but after adding this to my server, it has messed up the deploy script, it works when I first log in but after death or logging, I can’t deploy until next restart. Could someone look at my files and see where I messed up, it was working before I added this mod and I only changed what it says on the Installation part

https://github.com/serversteve21k/Tavi-Overpoch/tree/master/ServerSteve.Tavi

Thanks in advance

Quote

spotted my mistake
progressLoadingScreen 0.15;
call compile preprocessFileLineNumbers "dayz_code\compile\compiles.sqf";
//call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
call compile preprocessFileLineNumbers "addons\bike\init.sqf";
***call compile preprocessFileLineNumbers "dayz_code\compile\compiles.sqf";***
call compile preprocessFileLineNumbers "dayz_code\init\compiles.sqf";
progressLoadingScreen 0.25;

 

Link to comment
Share on other sites

  • 7 months later...

I have a noob question I have installed this all is ok and the majority is understandable  but I can't figure out how to make an Info 2, 3 and 4 page 
 

_info2Text = "Info 2"; //Text that will go on info button 2
info2script = {((ctrlParent (_this select 0)) closeDisplay 7777); createDialog "info2";}; //script that info button 2 will use

_info3Text = "Info 3"; //Text that will go on info button 3
info3script = {((ctrlParent (_this select 0)) closeDisplay 7777); createDialog "info3";}; //script that action info 3 will use

_info4Text = "Info 4"; //Text that will go on info button 4
info4script = {((ctrlParent (_this select 0)) closeDisplay 7777); createDialog "info4";}; //script that action info 4 will use

What do I do? Where do I write the information for the them pages? Click on them nothing happens how do I create them and how do I call them? I understand how to set up the rules but do not have the knowledge to understand how to create the info pages it doesn't appear to have instructions for info setup

Link to comment
Share on other sites

  • 4 months later...

This is a great script! Only thing I can't get to work are the deplorables. The bike works great on its own but when I add the other vehicles, the wrong vehicle deploys when I pick the bike. The rules and info work exactly as intended. 

Great job on this. Is there an update for 1.0.6.2 or is it not necessary?

Link to comment
Share on other sites

On 7/3/2020 at 6:07 PM, Stephen said:

This is a great script! Only thing I can't get to work are the deplorables. The bike works great on its own but when I add the other vehicles, the wrong vehicle deploys when I pick the bike. The rules and info work exactly as intended. 

Great job on this. Is there an update for 1.0.6.2 or is it not necessary?

This script worked out great! Scroll up and see the discussion with Mig and Kmiller for the deployables if anyone has a problem in the future. Still works in 1.0.6.2.

 

Link to comment
Share on other sites

  • 1 month later...

This is really fab and playing with it taught me so much about dialog menus etc. Big thanks for sharing it and it is still working on 1.0.6.2 but after reading though the files some more I found that keyboard.sqf has been updated since 1.0.6.1 so I updated the new keyboard.sqf to the latest version for anyone else anal like me here is a copy of the 1.0.6.2 keyboard.sqf with thedukes changes for his menu/mod

Spoiler

// (c) [email protected], licensed to DayZMod for the community

#include "\ca\editor\Data\Scripts\dikCodes.h"

_dikCode = _this select 1;
_shiftState = _this select 2;
_ctrlState = _this select 3;
_altState = _this select 4;
_handled = false;

if (isNil "keyboard_keys") then {
    _cancelBuild = {
        DZE_cancelBuilding = true;
        call dayz_EjectPlayer;
        _handled = false;
        if (r_player_dead) then {_handled = true;}; // Disable ESC after death
    };
    _dze_f = {
         if (!_ctrlState && !_altState) then {DZE_F = true;};
    };
    _dze_q = {
         if (!_ctrlState && !_altState) then {DZE_Q = true;};
         if (!_ctrlState && _altState) then {DZE_Q_alt = true;};
         if (_ctrlState && !_altState) then {DZE_Q_ctrl = true;};
    };
    _dze_z = {
         if (!_ctrlState && !_altState) then {DZE_Z = true;};
         if (!_ctrlState && _altState) then {DZE_Z_alt = true;};
         if (_ctrlState && !_altState) then {DZE_Z_ctrl = true;};
    };
    _autoRun = {
        if (!dayz_autoRun) then {
            dayz_autoRun = true;
            dayz_autoRunThread = [] spawn {
                _weapon = currentWeapon player;
                while {dayz_autoRun} do {
                    // SurfaceIsWater does not work for ponds
                    // Check weapon to detect Arma action (dayz action is handled in dz_fn_switchWeapon)
                    if (player != vehicle player or (surfaceIsWater getPosASL player) or ((call fn_nearWaterHole) select 0) or (currentWeapon player != _weapon) or r_fracture_legs) exitWith {
                        call dayz_autoRunOff;
                    };
                    player playAction "FastF";
                    uiSleep 0.5;
                };
            };
        } else {
            call dayz_autoRunOff;
        };
        _handled = true;
    };
    _filterCheat = {
        //Overriding default engine handling does not stop cheat input, need manual disableUserInput too
        _handled = [displayNull,_dikCode,_shiftState] call dze_filterCheats;
    };
    _openGroups = {
        if (dayz_requireRadio && !("ItemRadio" in items player)) then {
            localize "STR_EPOCH_NEED_RADIO" call dayz_rollingMessages;
        } else {
            if (isNull findDisplay 80000) then {
                if (!isNil "dayz_groupInit") then {[] spawn dayz_openGroupDialog;};
            } else {
                findDisplay 80000 closeDisplay 2;
            };
        };
        _handled = true;
    };
    _muteSound = {
        call player_toggleSoundMute;
        _handled = true;
    };
    _rifle = {
        2 call dz_fn_switchWeapon;
        _handled = true;
    };
    _pistol = {
        3 call dz_fn_switchWeapon;
        _handled = true;
    };
    _melee = { // Also works for rifle on back if DZE_TwoPrimaries = 2;
        4 call dz_fn_switchWeapon;
        _handled = true;
    };
    _throwable = { // select next non empty throwable weapon
        if (vehicle player == player) then {
            _ammo_throwable = [];
            _muzzles_throwable = [];
            _weapon_throwable = [];
            {
                _weapon = _x;
                _muzzles = getArray(configFile >> "cfgWeapons" >> _weapon >> "muzzles");
                if (count _muzzles == 0) then { _muzzles = [_weapon ]; };
                {
                    _muzz = _x;
                    {
                        if (_x in magazines player) then {
                            _ammo_throwable set [ count _ammo_throwable, getText(configFile >> "cfgMagazines" >> _x >> "ammo") ];
                            _muzzles_throwable set [ count _muzzles_throwable, _muzz ];
                            _weapon_throwable set [ count _weapon_throwable, _weapon ];
                        };                      
                    } forEach getArray(configFile >> "cfgWeapons" >> _weapon >> _muzz >> "magazines");
                } forEach _muzzles;
            } forEach ["Throw"];

            _magCount = count _ammo_throwable;
            if (_magCount > 0) then {
                if (isNil "KB_CurrentThrowable") then { KB_CurrentThrowable = -1; };
                _currentAmmo = (weaponState player) select 3;       
                _idx = _ammo_throwable find _currentAmmo;
                if (_idx >= 0) then { KB_CurrentThrowable = _idx; };
                KB_CurrentThrowable = (KB_CurrentThrowable + 1) mod _magCount;
                player selectWeapon (_muzzles_throwable select KB_CurrentThrowable);
                _handled = true;
            };
        };
    };
    _surrender = {
        call player_surrender;
        _handled = true;
    };
    _gear = {
        if ((vehicle player != player) and !_shiftState and !_ctrlState and !_altState && !dialog) then {
            createGearDialog [player, "RscDisplayGear"];
            _handled = true;
        }
        else { if ((vehicle player == player) and (speed vehicle player > 0)) then {
            //[objNull, player, rSwitchMove,""] call RE;
            _handled = true;
        };};
    };
    _forcesave = {
        dayz_lastCheckBit = diag_ticktime;
        call player_forceSave;
        call dayz_EjectPlayer;
    };
    _forcesave2 = {
        if ((!isNull (findDisplay 106)) OR dialog) then {
            call player_forceSave;          
        };
    };
    _drop = {
        if (r_drag_sqf) then {
            _doors = nearestObjects [player, DayZ_DropDrageeObjects, 3]; //Prevent dropping dragged player through objects
            if (count _doors > 0) then {_handled = true;};
            force_dropBody = true;
        } else {
            _doors = nearestObjects [player, DZE_DoorsLocked, 3];
            if (count _doors > 0 && {speed player > 0}) then {_handled = true;}; //Prevent sprint and prone through doors glitch
        };
    };
    _interrupt = {
        if (vehicle player == player) then { //allow med actions in moving vehicles
            r_interrupt = true;
        };
        if (DZE_Surrender) then {call dze_surrender_off};
        if (dayz_autoRun) then {call dayz_autoRunOff;};
    };
    // TODO: left/right, when gear open: onKeyDown = "[_this,'onKeyDown',0,107,0,107] execVM '\z\addons\dayz_code\system\handleGear.sqf'";
    _noise = {
        //Overriding default engine handling does not stop combination binds, need manual disableUserInput too
        _handled = [displayNull,_dikCode,_shiftState] call dze_filterCheats;
        
        if (diag_ticktime - dayz_lastCheckBit > 10 && !(_dikCode in channel_keys)) then {
            dayz_lastCheckBit = diag_ticktime;
            [player,20,true,(getPosATL player)] call player_alertZombies;
        };
    };
    _journal = {
        if (!dayz_isSwimming and !dialog) then {
            [player,4,true,(getPosATL player)] call player_alertZombies;
            createDialog 'horde_journal_front_cover';
        };
        _handled = true;
    };

    _build_left = {
        DZE_4 = true;
        // fence construction
        if (0 != count Dayz_constructionContext) then {
            _angleRef = Dayz_constructionContext select 1;
            _dir = _angleRef - (getDir player) -5;
            if (_dir > 180) then {_dir = _dir - 360}; 
            if (_dir < -180) then {_dir = _dir + 360};
            if ( _dir > -75) then {
                _new = floor((_angleRef - 5)/5)*5;
                Dayz_constructionContext set [ 1, _new]; // favorite angle
                r_interrupt = true;
            };
            _handled = true;
        };
        // tents and stash construction
        _object = player getVariable ["constructionObject", objNull];
        if (!isNull _object) then {
            _dir = getDir _object - 3;
            _object setDir _dir;
            _handled = true;
        };
        dayz_dodge = true;
    };
    _build_right = {
        DZE_6 = true;
        if (0 != count Dayz_constructionContext) then {
            _angleRef = Dayz_constructionContext select 1;
            _dir = _angleRef - (getDir player) +5;
            if (_dir > 180) then { _dir = _dir - 360; }; 
            if (_dir < -180) then { _dir = _dir + 360; };
            if (_dir < 75) then {
                _new = ceil((_angleRef + 5)/5)*5;
                Dayz_constructionContext set [ 1, _new]; // favorite angle
                r_interrupt = true;
            };
            _handled = true;
        };
        // tents and stash construction
        _object = player getVariable ["constructionObject", objNull];
        if (!isNull _object) then {
            _dir = getDir _object + 3;
            _object setDir _dir;
            _handled = true;
        };
        dayz_dodge = true;
    };

    _build_camOnOff = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildCamera.sqf";

    _build_str8OnOff = {
        if (0 != count Dayz_constructionContext) then {
            Dayz_constructionContext set [ 5, !(Dayz_constructionContext select 5) ];
            _handled = true;
            r_interrupt = true;
        };
        
        if (animationState player in ["bunnyhopunarmed","bunnyhoprifle"]) then {
            //Fixes invisible weapon switch glitch if double tapping vault with no weapon in hands
            _handled = true;
        };
        if (player isKindOf  "PZombie_VB") then {
            _handled = true; // do not allow player zombies to vault or jump
        } else {
            _nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8];
            if (count _nearbyObjects > 0) then {
                if ((diag_tickTime - dayz_lastCheckBit > 4)) then {
                    [objNull, player, rSwitchMove,"GetOver"] call RE;
                    player playActionNow "GetOver";
                    dayz_lastCheckBit = diag_tickTime;
                } else {
                    _handled = true;
                };
            };
        };
    };
    
//ESLKESLK Menu
    _informenu = {if (isNull findDisplay 7777) then {
    execVM "Custom\menu\menu_init.sqf";
    };
    _handled = true;
    };
    
    _block = {
        _handled = true;
    };
    
    _addArray = {
        {
            keyboard_keys set [_x, _this select 1];
        } forEach (_this select 0);
    };

    keyboard_keys = [];
    channel_keys = [];
    voice_keys = [];
    {voice_keys = voice_keys + (actionKeys _x)} count voice_actions;
    {channel_keys = channel_keys + (actionKeys _x)} count ["NextChannel","PrevChannel"];
    keyboard_keys resize 256;
    [[DIK_TAB], _informenu] call _addArray;
    [[DIK_ESCAPE], _cancelBuild] call _addArray;
    [[DIK_INSERT], {DZE_Q_alt = true;}] call _addArray;
    [[DIK_A,DIK_D,DIK_LEFT,DIK_RIGHT], _interrupt] call _addArray;
    [[DIK_F], _dze_f] call _addArray;
    [[DIK_PRIOR], _dze_q] call _addArray;
    [[DIK_NEXT], _dze_z] call _addArray;
    [[DIK_Q], {DZE_4 = true;}] call _addArray;
    [[DIK_E], {DZE_6 = true;}] call _addArray;
    [[DIK_0], _autoRun] call _addArray;
    [[DIK_NUMPADMINUS,DIK_LSHIFT], _filterCheat] call _addArray;
    [[DIK_SPACE], {DZE_5 = true;}] call _addArray;
    [actionKeys "User6", {DZE_F = true;}] call _addArray;
    [actionKeys "User7", {DZE_Q_ctrl = true;}] call _addArray;
    [actionKeys "User8", {DZE_Z_ctrl = true;}] call _addArray;
    [actionKeys "User13", {DZE_Q_alt = true;}] call _addArray;
    [actionKeys "User14", {DZE_Z_alt = true;}] call _addArray;
    [actionKeys "User15", {DZE_Q = true;}] call _addArray;
    [actionKeys "User16", {DZE_Z = true;}] call _addArray;
    [actionKeys "User17", {DZE_4 = true;}] call _addArray;
    [actionKeys "User18", {DZE_6 = true;}] call _addArray;
    [actionKeys "User19", {DZE_5 = true;}] call _addArray;
    [actionKeys "Surrender", _surrender] call _addArray;
    [[DIK_1], _rifle] call _addArray;
    [[DIK_2], _pistol] call _addArray;
    [[DIK_3], _melee] call _addArray;
    //[[DIK_4], _throwable] call _addArray;
    [actionKeys "Gear", _gear] call _addArray;
    [actionKeys "Prone", _drop] call _addArray;
    [actionKeys "Crouch", _drop] call _addArray;
    [actionKeys "MoveLeft", _interrupt] call _addArray;
    [actionKeys "MoveRight", _interrupt] call _addArray;
    [actionKeys "MoveForward", _interrupt] call _addArray;
    [actionKeys "MoveBack", _interrupt] call _addArray;
    [actionKeys "TurnLeft", _interrupt] call _addArray;
    [actionKeys "TurnRight", _interrupt] call _addArray;
    [actionKeys "PushToTalk", _noise] call _addArray;
    [actionKeys "PushToTalkAll", _noise] call _addArray;
    [actionKeys "PushToTalkCommand", _noise] call _addArray;
    [actionKeys "PushToTalkDirect", _noise] call _addArray;
    [actionKeys "PushToTalkGroup", _noise] call _addArray;
    [actionKeys "PushToTalkSide", _noise] call _addArray;
    [actionKeys "PushToTalkVehicle", _noise] call _addArray;
    [actionKeys "VoiceOverNet", _noise] call _addArray;
    [actionKeys "NextChannel", _noise] call _addArray;
    [actionKeys "PrevChannel", _noise] call _addArray;
    [actionKeys "Chat", _noise] call _addArray;
    [actionKeys "User20", _journal] call _addArray;
    [actionKeys "Diary", _journal] call _addArray;
    [actionKeys "NetworkStats", _journal] call _addArray;
    [[DIK_F1], _muteSound] call _addArray;
    //[[DIK_F4, DIK_TAB, DIK_DELETE], _forcesave] call _addArray;
    //[[DIK_F4, DIK_RMENU, DIK_LMENU,DIK_LSHIFT,DIK_RSHIFT,DIK_ESCAPE], _forcesave2] call _addArray;
    [actionKeys "LeanLeft", _build_left ] call _addArray;
    [actionKeys "LeanRight", _build_right ] call _addArray;
    [actionKeys "PersonView", _build_camOnOff ] call _addArray; // Camera Mode
    [actionKeys "GetOver", _build_str8OnOff ] call _addArray; // V
//  [[DIK_NUMPAD7], _rotate_left] call _addArray;
//  [[DIK_NUMPAD9], _rotate_right] call _addArray;
    [actionKeys "ForceCommandingMode", {DZE_5 = true;_handled = true;}] call _addArray;
    [[  DIK_F9,DIK_F10,DIK_F11,DIK_F12,
        DIK_F8,DIK_F7,DIK_F6,DIK_F5,DIK_F4,
        DIK_F3,DIK_F2,DIK_9,
        DIK_8,DIK_7,DIK_6,DIK_5,DIK_4], _block] call _addArray;
    if (dayz_groupSystem) then {
        [[DIK_F5], _openGroups] call _addArray;
        [[DIK_LWIN,DIK_RWIN], {dayz_groupNameTags = !dayz_groupNameTags;_handled = true;}] call _addArray;
        [actionKeys "TacticalView", _block] call _addArray;
    };
    diag_log "keyboard_keys reset";
    if (!isNil "bis_fnc_halo_keydown_eh") then {bis_fnc_halo_keydown_eh = (finddisplay 46) displayaddeventhandler ["keydown","_this call bis_fnc_halo_keydown;"];}; // halo in progress
};

if (r_player_unconsciousInputDisabled) exitWith {true};
_code = keyboard_keys select _dikCode;
if (!isNil "_code") then {
    call _code;
};

_handled

 

Link to comment
Share on other sites

  • 11 months later...

Here is the new keyboard.sqf to work this cool mod with Epoch 1.0.7 I just made it for our server :) 

 

Spoiler

// (c) [email protected], licensed to DayZMod for the community

#include "\ca\editor\Data\Scripts\dikCodes.h"

local _dikCode = _this select 1;
local _shiftState = _this select 2;
local _ctrlState = _this select 3;
local _altState = _this select 4;
local _handled = false;

if (isNil "keyboard_keys") then {
    local _cancelBuild = {
        DZE_cancelBuilding = true;
        call dayz_EjectPlayer;
        _handled = false;
        if (r_player_dead) then {_handled = true;}; // Disable ESC after death
    };
    local _dze_f = {
        if (!_ctrlState && !_altState) then {DZE_F = true;};
    };
    local _dze_q = {
        if (!_ctrlState && !_altState) then {DZE_Q = true;};
        if (!_ctrlState && _altState) then {DZE_Q_alt = true;};
        if (_ctrlState && !_altState) then {DZE_Q_ctrl = true;};
    };
    local _dze_z = {
        if (!_ctrlState && !_altState) then {DZE_Z = true;};
        if (!_ctrlState && _altState) then {DZE_Z_alt = true;};
        if (_ctrlState && !_altState) then {DZE_Z_ctrl = true;};
    };
    local _autoRun = {
        if (!dayz_autoRun) then {
            dayz_autoRun = true;
            dayz_autoRunThread = [] spawn {
                local _weapon = currentWeapon player;
                while {dayz_autoRun} do {
                    // SurfaceIsWater does not work for ponds
                    // Check weapon to detect Arma action (dayz action is handled in dz_fn_switchWeapon)
                    if (player != vehicle player || {r_fracture_legs || {surfaceIsWater getPosASL player} || {currentWeapon player != _weapon} || {(call fn_nearWaterHole) select 0}}) exitWith {
                        call dayz_autoRunOff;
                    };
                    player playAction "FastF";
                    uiSleep 0.5;
                };
            };
        } else {
            call dayz_autoRunOff;
        };
        _handled = true;
    };
    local _filterCheat = {
        //Overriding default engine handling does not stop cheat input, need manual disableUserInput too
        _handled = [displayNull,_dikCode,_shiftState] call dze_filterCheats;
    };
    local _openGroups = {
        if (dayz_requireRadio && {!("ItemRadio" in items player)}) then {
            localize "STR_EPOCH_NEED_RADIO" call dayz_rollingMessages;
        } else {
            if (isNull findDisplay 80000) then {
                if (!isNil "dayz_groupInit") then {[] spawn dayz_openGroupDialog;};
            } else {
                findDisplay 80000 closeDisplay 2;
            };
        };
        _handled = true;
    };
    local _muteSound = {
        call player_toggleSoundMute;
        _handled = true;
    };
    local _statusUI = {
        DZE_UI = DZE_UI + 1;
        if (DZE_UI == 6) then {DZE_UI = 0; [format[localize "STR_UI_STATUS_ICONS" + " %1",localize "STR_DISABLED"],1] call dayz_rollingMessages;};
        if (DZE_UI == 1) then {[format[localize "STR_UI_STATUS_ICONS" + " %1",localize "STR_ENABLED"],1] call dayz_rollingMessages;};
        profileNamespace setVariable ["statusUI",DZE_UI];
        saveProfileNamespace;
        call ui_changeDisplay;
        _handled = true;
    };
    local _rifle = {
        2 call dz_fn_switchWeapon;
        _handled = true;
    };
    local _pistol = {
        3 call dz_fn_switchWeapon;
        _handled = true;
    };
    local _melee = { // Also works for rifle on back if DZE_TwoPrimaries = 2;
        4 call dz_fn_switchWeapon;
        _handled = true;
    };
    local _surrender = {
        call player_surrender;
        _handled = true;
    };
    local _gear = {
        if ((vehicle player != player) && {!_shiftState && !_ctrlState && !_altState && !dialog}) then {
            createGearDialog [player, "RscDisplayGear"];
            _handled = true;
        } else {
            if ((vehicle player == player) && {speed vehicle player > 0}) then {
                //[objNull, player, rSwitchMove,""] call RE;
                _handled = true;
            };
        };
    };
    local _forcesave = {
        if (diag_tickTime - dayz_lastSave > 10) then {
            call player_forceSave;
        };
    };
    local _drop = {
        local _doors = [];
        if (r_drag_sqf) then {
            _doors = nearestObjects [player, DayZ_DropDrageeObjects, 3]; //Prevent dropping dragged player through objects
            if (count _doors > 0) then {_handled = true;};
            force_dropBody = true;
        } else {
            _doors = nearestObjects [player, DZE_DoorsLocked, 3];
            if (count _doors > 0 && {speed player > 0}) then {_handled = true;}; //Prevent sprint and prone through doors glitch
        };
    };
    local _interrupt = {
        r_interrupt = true;
        if (DZE_Surrender) then {call dze_surrender_off};
        if (dayz_autoRun) then {call dayz_autoRunOff;};
    };
    // TODO: left/right, when gear open: onKeyDown = "[_this,'onKeyDown',0,107,0,107] execVM '\z\addons\dayz_code\system\handleGear.sqf'";
    local _noise = {
        //Overriding default engine handling does not stop combination binds, need manual disableUserInput too
        _handled = [displayNull,_dikCode,_shiftState] call dze_filterCheats;

        if (diag_ticktime - dayz_lastCheckBit > 10 && {!(_dikCode in channel_keys)}) then {
            dayz_lastCheckBit = diag_ticktime;
            [player,20,true,(getPosATL player)] call player_alertZombies;
        };
    };
    local _journal = {
        if (!dayz_isSwimming && !dialog) then {
            [player,4,true,(getPosATL player)] call player_alertZombies;
            createDialog 'horde_journal_front_cover';
        };
        _handled = true;
    };

    local _bunnyhop = {
        r_interrupt = true;

        if (animationState player in ["bunnyhopunarmed","bunnyhoprifle"]) then {
            //Fixes invisible weapon switch glitch if double tapping vault with no weapon in hands
            _handled = true;
        };
        if (player isKindOf "PZombie_VB") then {
            _handled = true; // do not allow player zombies to vault or jump
        } else {
            local _nearbyObjects = nearestObjects [getPosATL player, dayz_disallowedVault, 8];
            if (count _nearbyObjects > 0) then {
                if (diag_tickTime - dayz_lastCheckBit > 4) then {
                    [objNull, player, rSwitchMove,"GetOver"] call RE;
                    player playActionNow "GetOver";
                    dayz_lastCheckBit = diag_tickTime;
                } else {
                    _handled = true;
                };
            };
        };
    };
    
    //ESLKESLK Menu
    local _informenu = {if (isNull findDisplay 7777) then {
    execVM "custom\menu\menu_init.sqf";
    };
    _handled = true;
    };

    local _block = {
        _handled = true;
    };

    local _addArray = {
        {
            if (_x <= 999999) then {
                keyboard_keys set [_x, _this select 1];
            };
        } forEach (_this select 0);
    };

    keyboard_keys = [];
    channel_keys = [];
    voice_keys = [];
    {voice_keys = voice_keys + (actionKeys _x)} count voice_actions;
    {channel_keys = channel_keys + (actionKeys _x)} count ["NextChannel","PrevChannel"];
    keyboard_keys resize 256;
    [[DIK_TAB], _informenu] call _addArray;
    [[DIK_ESCAPE], _cancelBuild] call _addArray;
    [[DIK_INSERT], {DZE_Q_alt = true;}] call _addArray;
    [[DIK_A,DIK_D,DIK_LEFT,DIK_RIGHT], _interrupt] call _addArray;
    [[DIK_F], _dze_f] call _addArray;
    [[DIK_PRIOR], _dze_q] call _addArray;
    [[DIK_NEXT], _dze_z] call _addArray;
    [[DIK_Q], {DZE_4 = true;}] call _addArray;
    [[DIK_E], {DZE_6 = true;}] call _addArray;
    [[DIK_0], _autoRun] call _addArray;
    [[DIK_NUMPADMINUS,DIK_LSHIFT], _filterCheat] call _addArray;
    [[DIK_SPACE], {DZE_5 = true;}] call _addArray;
    [actionKeys "User6", {DZE_F = true;}] call _addArray;
    [actionKeys "User7", {DZE_Q_ctrl = true;}] call _addArray;
    [actionKeys "User8", {DZE_Z_ctrl = true;}] call _addArray;
    [actionKeys "User13", {DZE_Q_alt = true;}] call _addArray;
    [actionKeys "User14", {DZE_Z_alt = true;}] call _addArray;
    [actionKeys "User15", {DZE_Q = true;}] call _addArray;
    [actionKeys "User16", {DZE_Z = true;}] call _addArray;
    [actionKeys "User17", {DZE_4 = true;}] call _addArray;
    [actionKeys "User18", {DZE_6 = true;}] call _addArray;
    [actionKeys "User19", {DZE_5 = true;}] call _addArray;
    [actionKeys "Surrender", _surrender] call _addArray;
    [[DIK_1], _rifle] call _addArray;
    [[DIK_2], _pistol] call _addArray;
    [[DIK_3], _melee] call _addArray;
    [actionKeys "Gear", _gear] call _addArray;
    [actionKeys "Prone", _drop] call _addArray;
    [actionKeys "Crouch", _drop] call _addArray;
    [actionKeys "MoveLeft", _interrupt] call _addArray;
    [actionKeys "MoveRight", _interrupt] call _addArray;
    [actionKeys "MoveForward", _interrupt] call _addArray;
    [actionKeys "MoveBack", _interrupt] call _addArray;
    [actionKeys "TurnLeft", _interrupt] call _addArray;
    [actionKeys "TurnRight", _interrupt] call _addArray;
    [actionKeys "PushToTalk", _noise] call _addArray;
    [actionKeys "PushToTalkAll", _noise] call _addArray;
    [actionKeys "PushToTalkCommand", _noise] call _addArray;
    [actionKeys "PushToTalkDirect", _noise] call _addArray;
    [actionKeys "PushToTalkGroup", _noise] call _addArray;
    [actionKeys "PushToTalkSide", _noise] call _addArray;
    [actionKeys "PushToTalkVehicle", _noise] call _addArray;
    [actionKeys "VoiceOverNet", _noise] call _addArray;
    [actionKeys "NextChannel", _noise] call _addArray;
    [actionKeys "PrevChannel", _noise] call _addArray;
    [actionKeys "Chat", _noise] call _addArray;
    [actionKeys "User20", _journal] call _addArray;
    [actionKeys "Diary", _journal] call _addArray;
    [actionKeys "NetworkStats", _journal] call _addArray;
    [[DIK_F1], _muteSound] call _addArray;
    [[DIK_F3], _statusUI] call _addArray;
    [[DIK_F4], {if (diag_tickTime - dayz_lastSave > 10) then {call player_forceSave;};_handled = true;}] call _addArray;
    //[[DIK_TAB,DIK_DELETE], _forcesave] call _addArray;
    [actionKeys "LeanLeft", {DZE_4 = true; dayz_dodge = true;}] call _addArray;
    [actionKeys "LeanRight", {DZE_6 = true; dayz_dodge = true;}] call _addArray;
    [actionKeys "GetOver", _bunnyhop] call _addArray; // V
    [actionKeys "ForceCommandingMode", {DZE_5 = true;_handled = true;}] call _addArray;
    [[  DIK_F9,DIK_F10,DIK_F11,DIK_F12,
        DIK_F8,DIK_F7,DIK_F6,DIK_F5,
        DIK_F2,DIK_9,
        DIK_8,DIK_7,DIK_6,DIK_5,DIK_4,DIK_BACK], _block] call _addArray;
    if (dayz_groupSystem) then {
        [[DIK_F5], _openGroups] call _addArray;
        [[DIK_LWIN,DIK_RWIN], {dayz_groupNameTags = !dayz_groupNameTags;_handled = true;}] call _addArray;
        [actionKeys "TacticalView", _block] call _addArray;
    };
    [actionKeys "DSInterface", _block] call _addArray;
    [[DIK_P], {if (_shiftState) then {_handled = true;};}] call _addArray;
    //diag_log "keyboard_keys reset";
};

if (r_player_unconsciousInputDisabled) exitWith {true};
local _code = keyboard_keys select _dikCode;
if (!isNil "_code") then {
    call _code;
};

_handled

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...