Jump to content
theduke

[RELEASE] Custom GUI / Menu UPDATED for 1061

Recommended Posts

Hi Epoch community,
Have you ever wanted a way for players to be able to see your server rules while in-game?
Are you tired of repeating yourself with simple answers to simple questions?
Looking for a different way to deploy items or call certain scripts?

Our community uses mostly scripts from this awesome epoch community. Its our time to give back :)
I've decided to make a release version of my GUI for everyone to use.

https://github.com/theduke77/Custom-Menu

In the video, i have my community colors in the GUI, the release version I tried to match the zupa colors.

Video

Spoiler

 

I've received tremendous help from SHIX. Most of the credit goes to him for explaining to me how to do this.
also, I've used the code he provided as a template and built this from that.
He kindly allowed me to share with all of you

Ok, now for the fun part.
This is NOT for someone new to the world of epoch server management. (probly because of my instructions lol)
This is NOT a plug-n-play addon. You must configure all the files and customize the menu
I would strongly suggest you have a test server to be able to test it as you create new pages.
Try one page to make sure it looks good, then go from there.
If you want to change the colors of stuff, check out the options section before creating pages.

I will do my best to explain to the best of my knowledge.
I'm far from being a coder lol

Tools required

Notepad ++
PBO Tool
patience...with my instructions ;)
TextView (optional)

Installation:

Spoiler

Extract your mission.pbo
Copy the menu folder from the download into your custom folder. If you don't have a custom folder create one.

open description.ext

add this at the bottom
Its important that the defines is at the top!!

#include"custom\menu\defines.hpp"
#include"custom\menu\menu.hpp"
#include"custom\menu\rules.hpp"
#include"custom\menu\rules2.hpp"

save and close

Open your custom compiles and look for

DZ_KeyDown_EH = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\keyboard.sqf";

Replace that line with

DZ_KeyDown_EH = compile preprocessFileLineNumbers "custom\menu\keyboard.sqf";

Save and close

For players using Infistore, you will need to add the dialog numbers, 7777,7778,7779

7777 - menu.hpp
7778 - rules.hpp
7779 - rules2.hpp

Extract your dayz_server.pbo

Open your AHConfig.sqf
look for

_ALLOWED_Dialogs

add the dialogs. EX: ...9900,7777,7778,7779)  If you created 4 extra pages, you will need to add all those dialog numbers. (will explain a bit more later)

Now that the files are in place, its time to configure them.
First, make yourself a drink and get ready :)

Open menu_init.sqf. If you read the comments for each section it explains what you need to know
Here you can set the call lines or scripts for your actions, and deployables.

Second, open rules_init.sqf
In this file, the comments explain what you need to know.
I've included a couple files as templates to help you get started.

How to create new pages

Spoiler

Copy and paste  rules2_init.sqf and rules2.hpp.  Rename them rules3_init.sqf and rules3.hpp

Open your rules3.hpp

Things to pay attention to when creating a new page are Highlighted in bold

- The display name
At the very top, in this case its "rules2". Change it to rules3.

class rules2
{
    idd = 7779;
    movingenable=false;
    class Controls
    { 

- The Dialog number, also at the very top
For each new page you create, you will need to change the dialog number and increase its number by 1

change
 

class rules2
{
    idd = 7779;
    movingenable=false;
	class Controls
	{ 

to
 

class rules3
{
    idd = 7780;
    movingenable=false;
	class Controls
	{ 

- The NEXT and PREVIOUS buttons
For this scenario, we will work as if page 3 is our last page for our "rules" section. Do a search for "previous", without the quotes. you should fine this block of code

class slk_previous: slkRscButton
{
    idc = 1602;
    text = "Previous Page"; //--- ToDo: Localize;
    x = 0.396862 * safezoneW + safezoneX;
    y = 0.8102 * safezoneH + safezoneY;
    w = 0.0979687 * safezoneW;
    h = 0.044 * safezoneH;
    sizeEx = 0.050;
    style = 2;
    colorBackground[] = {0.047,0.376,0.776,1};
    onButtonClick = "call previous2script;";
};

Highlighted in black is the call from line 21 from rules2_init.sqf (will get to that just bellow).  As we are creating a new page, we will need to change it.

onButtonClick = "call previous3script;";

In rules3_init.sqf, line 21 changes from
previous2script = {((ctrlParent (_this select 0)) closeDisplay 7779); execvm 'custom\menu\YOUR_SCRIPT.sqf';}; //script that Previous button will use 

to

previous3script = {((ctrlParent (_this select 0)) closeDisplay 7780); execvm 'custom\menu\rules2_init.sqf';}; //script that Previous button will use 

pay attention to the dialog number and execvm line. our new dialog number has become 7780, so the call line must know which dialog to close when the button is pressed.
As this is a previous button, you want the execvm to call the rules2_init.sqf

For the next button, you would do the opposite. but in this example we don't need the next button because its our last page.
To remove the button from the page, you need to comment out the block of code. In bold is what you need to add to comment out the code.
 this /* opens the comment block
 this */ close the comment block

/*
class slk_next: slkRscButton
{
    idc = 1600;
    text = "Next Page"; //--- ToDo: Localize;
    x = 0.503082 * safezoneW + safezoneX;
    y = 0.8102 * safezoneH + safezoneY;
    w = 0.0979687 * safezoneW;
    h = 0.044 * safezoneH;
    sizeEx = 0.050;
    style = 2;
    colorBackground[] = {0.047,0.376,0.776,1};
    onButtonClick = "call next2script;";
};
*/

- The CLOSE MENU and RETURN buttons.

In each new page you create, you will need to find these 2 buttons in the *.hpp you created, just like the next and previous buttons.
Block of code looks like this

class slk_return: slkRscButton
{
    idc = 1601;
    text = "Return to Menu"; //--- ToDo: Localize;
    x = 0.226719 * safezoneW + safezoneX;
    y = 0.808 * safezoneH + safezoneY;
    w = 0.103125 * safezoneW;
    h = 0.044 * safezoneH;
    sizeEx = 0.050;
    style = 2;
    colorBackground[] = {0.047,0.376,0.776,1};
    onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 7779); ExecVM 'custom\menu\menu_init.sqf';";
};

The only thing you need to pay attention to in this line is the dialog number.  So in this case our new page dialog number is 7780, we change it to this

onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 7780); ExecVM 'custom\menu\menu_init.sqf';";

Do the same for the CLOSE MENU button

Alright so now you've created a new page. Open the rules3_init.sqf and configure the rules as needed.

In each new "rules_init.sqf" you will create, you will need to change the display name
Around line 25 you will see some something like this

createDialog "rules2";

change it to 

createDialog "rules3";

For each new page you've created, you will need to add the dialog number to the infistore list (explained above)
For each new page you've created, you need to add only the HPP file to the bottom of your description.ext (#include "custom\menu\rules3.hpp")

And thats it for the install and configuration of the menu. Time for another drink ;)

OPTIONAL

Spoiler

- Adding a logo to the top left of the menu

Open the menu.hpp

Look for this block of code

class slk_picl: slkRscPicture
{
    idc = 1200;
    text = "custom\menu\logo.paa";
    x = 0.221562 * safezoneW + safezoneX;
    y = 0.137 * safezoneH + safezoneY;
    w = 0.128906 * safezoneW;
    h = 0.077 * safezoneH;
};

The highlighted line is the path to your logo. I just used my watermark logo. It needs to be in paa format.
create a PNG and import it into TextView made by bohemia. Save it as a PAA file.

I've also included a sample logo to use as a template.
If you don't want to use the logo, just comment out the block of code.

- Changing the colors of buttons and text
I would STRONGLY SUGGEST doing this before making a bunch of pages.

Visit this page to choose the colour you want
http://html-color-codes.info/

Visit this page to copy the HTML code into Kill Zone kids amazing converter for arma
http://killzonekid.com/hex-2-arma-gui-colour-converter/

Open menu.hpp
look for 

colorBackground[] = {0.047,0.376,0.776,1};

that is the line of code you need to change for the background color of the button.  Do the same thing for the pages

As for the text, you will need to go in each block in each page and add the color you choose.
each block will have slk_rules1 or slk_rules2 and so on...
Example:

class slk_rules1: slkRscStructuredText
{
	idc = 1100;

	text = ""; //--- ToDo: Localize;
	x = 0.226718 * safezoneW + safezoneX;
	y = 0.2778 * safezoneH + safezoneY;
	w = 0.546562 * safezoneW;
	h = 0.066 * safezoneH;
};

add your colour like so

class slk_rules1: slkRscStructuredText
{
    idc = 1100;

    text = ""; //--- ToDo: Localize;
    x = 0.226718 * safezoneW + safezoneX;
    y = 0.2778 * safezoneH + safezoneY;
    w = 0.546562 * safezoneW;
    h = 0.066 * safezoneH;
    colorText[] = {1,1,1,1}; //White
};

- Changing the button to open the menu

Open keyboard.sqf incuded in the download, or if you have a custom one.

Look for

[DIK_TAB], _informenu

and change DIK_TAB to anything you'd like. for example i changed my headphones to DIK_Y. so it now uses the Y key instead of the F1 key.

Known issues

Spoiler

If you hit the menu button twice, it seems to overlap the menu. Havnt figured that out yet

Players with smaller resolutions, the text can be cut out. This is due the the arma GUI resolution. In your arma 2 video settings, there is a option for the interface size. I have mine set to small. 
If someone knows how i can fix the first issue please let me know :)

Many thanks to SHIX. Without him explaining this GUI stuff to me I wouldn't of made it lol
Thanks to Kill Zone kids blogs, they are amazing to learn from.

Thanks casual_jeff for the 1061 fix

Hope you guys enjoy it.
I will support this to the best of my knowledge :)

 

Added keyboard.sqf for less confusion.  Thanks @RC_Robio
Also added instructions on how to change button to open the menu

Now with a github link also. Thanks @salival

 

Share this post


Link to post
Share on other sites
1 minute ago, salival said:

You should put your releases on GitHub so they are easier to fix bugs, track bugs and update

haha well tbh this is my only release that i made myself.  If i was a real scripter yeah i could make use of it. But as i just puts around i cant see it being worth it.

Share this post


Link to post
Share on other sites

Hi,

 

Firstly great work!

 

I have noticed in the keyboard.sqf there is this line of code: execVM "custom\eslk\eslkinit.sqf"; I assume this is mean to be: execVM "custom\menu_init.sqf";

Could you also confirm that the keybinding for the menu is TAB?  As I'm not actually getting the menu show up, might just be me being dumb here.

Share this post


Link to post
Share on other sites
12 hours ago, shayd said:

Hi,

 

Firstly great work!

 

I have noticed in the keyboard.sqf there is this line of code: execVM "custom\eslk\eslkinit.sqf"; I assume this is mean to be: execVM "custom\menu_init.sqf";

Could you also confirm that the keybinding for the menu is TAB?  As I'm not actually getting the menu show up, might just be me being dumb here.

ah crap thats my path   smh  lol thx ill fix it

 

EDIT:

 yes tab is the button by default. Your path should be (if you put the menu folder in the custom folder)

custom/menu/menu_init.sqf;

maybe that is why its not populating also.

But I updated the OP and the git is up to date

Share this post


Link to post
Share on other sites
On 11. 03. 2017. at 2:39 AM, theduke said:

Open your custom compiles and look for

DZ_KeyDown_EH = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\keyboard.sqf";

Replace that line with

DZ_KeyDown_EH = compile preprocessFileLineNumbers "custom\menu\keyboard.sqf";

Save and close

 

I can not find where to edit this? Whichever compiles I have found there are no such lines in it. 

Share this post


Link to post
Share on other sites

@heroesandbandits

custom compiles.sqf  (lines in red) (you will find it around line 685)

Spoiler

fn_niceSpot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_niceSpot.sqf";
fnc_Obj_FenceHandleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fence_handleDam.sqf";
object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
DZ_KeyDown_EH = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\keyboard.sqf";
fn_shuffleArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_shuffleArray.sqf";

call compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\init.sqf";
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\psrnd.sqf"; // pseudo random for plantSpanwer

change this line in red by:

DZ_KeyDown_EH = compile preprocessFileLineNumbers "custom\menu\keyboard.sqf";

Share this post


Link to post
Share on other sites
2 hours ago, heroesandbandits said:

Is it the compiles.sqf that is located in dayz_code.pbo?

yes, bring that over in the mission file, and open the init.sqf and change the path to your compiles.sqf

Share this post


Link to post
Share on other sites

the problem i was having  with this was the deploy_bike scripts :sad:

after i copy your deploy_bike.sqf 3 times and change the vehicles id to the ones i wanted :cool:  every time i open the menu and went to click on the vehicle i wanted to spawn in it was spawning in the wrong one 

i fixed this by using my old files and adding them into yours ... i did not make any of the .sqf

but this is what i done

in the menu folder i open up menu.HPP  went to line 300 , 348 and 413 and replace  onButtonClick = "call deployable1script;";  with this

Spoiler

onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 7777); ['TT650_Civ'] execVM 'scripts\menu\scripts\dpk.sqf';";

then i added the old SQF files in my new menu/scripts folder and for the people like me who dont no what you are doing i have marked the vehicle id and items what are needed to make the vehicles in bold

common.sqf 

Spoiler

EVDSellVehicles = false;
EVDGetMaterials = {
    private ["_type","_materials"];

    _type = _this select 0;

    switch (_type) do {
        case "TT650_Civ":        { _materials = [["PartGeneric", 1]]; };
        case "Fishing_Boat":    { _materials = [["PartGeneric", 1], ["PartEngine", 1]]; };
        case "AH6X_DZ":    { _materials = [["PartGeneric", 1], ["PartEngine", 1], ["PartVRotor", 1]]; };
    };

    _materials;
};

 

 

dpk.sqf

Spoiler

 

call compile preprocessFileLineNumbers "scripts\menu\scripts\common.sqf";

if (dayz_combat == 1) exitwith { cutText ["\n\nYou are in combat and cannot perform that action!", "PLAIN DOWN"] };

_nearWalls = nearestObjects [player, ["House","ModularItems","DZE_Housebase","BuiltItems","DZE_Base_Object"], 8];
if (count _nearWalls > 0) exitWith {cutText [format["\n\nYou are too close to a building or object!"], "PLAIN DOWN"];};

private ["_type","_inVehicle","_onLadder","_canDo","_materials","_proceed","_qty","_missing","_missingQty","_objectID"];

_type = _this select 0;

_inVehicle = (vehicle player != player);
_onLadder =    (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder and !_inVehicle);

if (_canDo) then {
    _materials = [_type] call EVDGetMaterials;

    // Dry run to see if all parts are available.
    _proceed = true;
    if (count _materials > 0) then {
        {
            _itemIn = _x select 0;
            _countIn = _x select 1;
        
            _qty = { _x == _itemIn } count magazines player;

            if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
        } forEach _materials;
    };

    if (_proceed) then {
        closeDialog 1;

        cutText ["\n\nDeploying vehicle started", "PLAIN DOWN"];
        
        [player,"repair",0,false] call dayz_zombieSpeak;
        [player,50,true,(getPosATL player)] spawn player_alertZombies;

        _started = true;
        _finished = true;

        if (_finished) then {
            _removed_total = 0; // count total of removed items
            _tobe_removed_total = 0; // count total of all to be removed items
            // Take items
            {
                _removed = 0;
                _itemIn = _x select 0;
                _countIn = _x select 1;
                _tobe_removed_total = _tobe_removed_total + _countIn;

                {
                    _configParent = configName(inheritsFrom(configFile >> "cfgMagazines" >> _x));
                    if( (_removed < _countIn) && ((_x == _itemIn) || (_configParent == _itemIn))) then {
                        _num_removed = ([player,_x] call BIS_fnc_invRemove);
                        _removed = _removed + _num_removed;
                        _removed_total = _removed_total + _num_removed;
                        if(_num_removed >= 1) then {
                            _temp_removed_array set [count _temp_removed_array,_x];
                        };
                    };

                } forEach magazines player;

            } forEach _materials;
        
            // Only proceed if all parts were removed successfully
            if(_removed_total == _tobe_removed_total) then {
                if (EVDSellVehicles) then {
                    _objectID = str(round(random 999999));
                } else {
                    _objectID = "0";
                };
                
                _offset = [0,7,0];
                _worldPos = player modelToWorld _offset;
                _object = _type createVehicle (_worldPos);
                _object setVariable ["ObjectID",_objectID, true];
                _object setVariable ["ObjectUID",_objectID, true];
                _degrees = getDir player;
                _object setDir _degrees;
                
                _object addEventHandler ["GetIn",{
                    _nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: This vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
                }];
                
                player reveal _object;
                clearWeaponCargoGlobal _object;
                clearMagazineCargoGlobal _object;
                _object setVehicleAmmo 0;

                cutText ["\n\nYou've built a vehicle!", "PLAIN DOWN"];
            } else {
                // Refund parts since we failed
                {player addMagazine _x;} forEach _temp_removed_array;

                cutText [format[(localize "str_epoch_player_151"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
            };
        } else {
            r_interrupt = false;
            player switchMove "";
            player playActionNow "stop";
            cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
        };
    } else {
        _textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
        cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
    };
} else {
    cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

pack.sqf

Spoiler


call compile preprocessFileLineNumbers "scripts\menu\scripts\common.sqf";

if (dayz_combat == 1) exitwith {
    _msg = "You can't pack vehicles while in combat.";
    systemChat ("[FEAR]"+str _msg);
};
if (count(crew _obj) > 0) exitwith {
    _msg = "Unable to pack vehicle because it currently has a passenger or driver!";
    systemChat ("[FEAR]"+str _msg);
};
if (((damage _obj) > 0.5) || !(canMove _obj)) exitwith {
    _msg = "This vehicle is too damaged to pack.";
    systemChat ("[FEAR]"+str _msg);
};

private ["_obj","_animState","_started","_finished"];

if(DZE_ActionInProgress) exitWith { cutText ["Vehicle packing already in progress." , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

player removeAction s_player_packVehicle;
s_player_packVehicle = 1;

_obj = _this select 3;

cutText ["Packing vehicle started", "PLAIN DOWN"];

[player,"repair",0,false] call dayz_zombieSpeak;
[player,50,true,(getPosATL player)] spawn player_alertZombies;

_started = true;
_finished = true;
        
if (_finished) then {
    // Double check that object is not null
    if(!isNull(_obj)) then {
        _ipos = getPosATL _obj;
        _type = typeOf _obj;

        _materials = [_type] call EVDGetMaterials;

        //Delete from hive
        _objectID  = _obj getVariable ["ObjectID","0"];
        _objectUID = _obj getVariable ["ObjectUID","0"];
        _activatingPlayer = player;
        PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
        publicVariableServer "PVDZE_obj_Delete";

        deleteVehicle _obj;

        if (_ipos select 2 < 0) then {
            _ipos set [2,0];
        };

        _radius = 1;

        // give refund items
        if((count _materials) > 0) then {
            _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
            {
                _itemOut = _x select 0;
                _countOut = _x select 1;
                if (typeName _countOut == "ARRAY") then {
                    _countOut = round((random (_countOut select 1)) + (_countOut select 0));
                };
                _item addMagazineCargoGlobal [_itemOut,_countOut];
            } forEach _materials;

            _item setposATL _iPos;

            player reveal _item;

            player action ["Gear", _item];
        };
    } else {
        cutText [(localize "str_epoch_player_91"), "PLAIN DOWN"];
    };
} else {
    r_interrupt = false;
    player switchMove "";
    player playActionNow "stop";
    cutText ["Cancelled packing vehicle", "PLAIN DOWN"];
};

DZE_ActionInProgress = false;
s_player_packVehicle = -1;

the pack.sqf is not letting me pack the vehicles in game but just wanted to add it in this as well

and the last problem i was having was the vehicles exploding but Juandayz help me out with this and told me to add this to my variables under

call dayz_resetSelfActions;

Spoiler

// EPOCH ADDITIONS
DZE_safeVehicle = ["ParachuteWest","ParachuteC","TT650_Civ","Fishing_Boat","AH6X_DZ"];

hope this helps out any one who was having problems with the deploy_bike script

 

Share this post


Link to post
Share on other sites

I love the menu system. I have seen it on many servers. I would love to have the view distances, can you share yours or explain how to implement it please. Also, I don't see where I can put like Information at the top and then the different buttons at the bottom. Am I missing something, or can you share or explain how to do this. Thank you.

Share this post


Link to post
Share on other sites

So I have this up and Running. I can't get into the first menu option, which is rules_init.sqf. it just closes the menu out completely. I only added the text and changed nothing else about it. I have another menu option called Building, that works great.

Share this post


Link to post
Share on other sites

So I have everything working except the bike script, which I have one already that I would like to use. Also, how do I change how the menu opens, TAB is used for some other things for players.

Share this post


Link to post
Share on other sites
3 hours ago, DAKA said:

So I have everything working except the bike script, which I have one already that I would like to use. Also, how do I change how the menu opens, TAB is used for some other things for players.

open keyboard.sqf supplied in the files.

look for

[[DIK_TAB], _informenu] call _addArray;

Change

DIK_TAB to your liking.

The dik codes can be found if you google dik codes bohemia

Share this post


Link to post
Share on other sites

Thank you very much. Would there be a way to make it so you use the mouse to scroll then click on the menu option. that would be handy too. Like the old Action Menu

 

Share this post


Link to post
Share on other sites

Hi Duke,

For the life of me i cant find how to add a button :)

I added the exception to infistar, i set its own id, defined the script etc

Button is shown with my text and when i press it nothing happens, its like infistar doesnt allow it (tried 2-3 codes btw lol) or exec doesnt point to correct sqf but it does..

Any help?

Share this post


Link to post
Share on other sites
6 hours ago, ReDBaroN said:

Great release @theduke thank you!

Can you tell me what I use to start a new line inside the text boxes? I have tried "<br />" but, that doesn't work...

Thanks

If i understand correctly, you are talking about rules and such right?

If I did understand correctly lol, you dont need to add breaks. Its a structured box, so it does it on its own.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
  • Advertisement
  • Supporters
  • Advertisement
  • Discord

×