Jump to content
  • 0

Right Click assistance needed


BetterDeadThanZed

Question

I am trying to install the right click deploy script: 

 

When I add it I get this when right clicking on my toolbox:

 

KvS2sa.png

 

It's missing the Deploy Bike option. If I click on the blank space, nothing happens. 

 

Here's my ui_selectSlot.sqf: http://pastebin.com/s9k69PRh

 

Here's my extra_rc.hpp:

class ExtraRc {
  class ItemRadio {
     class GroupManagement {
        text = "Group Management";
        script = "execVM 'custom\dzgm\loadGroupManagement.sqf'";
     };
  };
class ItemToolbox {
      class BuildBike {
         text = "Deploy Bike";
         script = "['MMT_Civ'] execVM 'custom\EVD\EVD_deploy.sqf'";
      };
class BuildMotorcycle {
         text = "Deploy Motorcycle";
         script = "['TT650_Civ'] execVM 'custom\EVD\EVD_deploy.sqf'";
      }; 
class BuildMozzie {
         text = "Deploy Mozzie";
         script = "['CSJ_GyroC'] execVM 'custom\EVD\EVD_deploy.sqf'";
      };
   };  
};

If anyone has suggestions on why this would happen, it would be appreciated! 

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

  • 0

Hi,

 

can you try to delete this line from my code (or comment it out):

 

_numActions = _numActions + 1; // if there are other item action after that (other mods) add 1 to _numactions

 

I was not 100% sure if this should be there. I need it as I have the Remote Vehicle Door Opener options after the Vehicle Pointer stuff.

Just to be sure that this is not causing that.

 

Let me know how the result looks like (1 option more or even worse (another one missing or something). It's all about counting the available options and to add the new ones below the existing ones. With different methods here it was difficult for me to understand how that works until I got it running for me.

 

EDIT:

But I guess as there is an if at the beginning of my code which checks for the key item and it only enters this part if clicked on a key, I guess this should change nothing.

I will have another look when I am back from work if not someone else already answered to this.

Link to comment
Share on other sites

  • 0

Try removing the script name ['MMT_Civ'] & ['TT650_Civ'] & ['CSJ_GyroC'] so it just executes the script

 

here's my working extra_rc.hpp

class ExtraRc {
    class ItemToolbox {
       {
            text = "Deploy Bike";
            script = "execVM 'deployables\mtbike\deploy.sqf'";
        };
        
    };
};

Obviously replace the path with yours

Link to comment
Share on other sites

  • 0

Hm, I don't know why you have this 2 times here?

 

        _erc_cfgActions = (missionConfigFile >> "WaTd" >> _item);
        _erc_numActions = (count _erc_cfgActions);
        if (isClass _erc_cfgActions) then {
                for "_j" from 0 to (_erc_numActions - 1) do
                {
                        _menu =  _parent displayCtrl (1600 + _j + _numActions);
                        _menu ctrlShow true;
                        _config =  (_erc_cfgActions select _j);
                        _text =  getText (_config >> "text");
                        _script =  getText (_config >> "script");
                        _height = _height + (0.025 * safezoneH);
                        uiNamespace setVariable ['uiControl', _control];
                        _menu ctrlSetText _text;
                        _menu ctrlSetEventHandler ["ButtonClick",_script];
                };
        };
       
   _erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
   _erc_numActions = (count _erc_cfgActions);
   if (isClass _erc_cfgActions) then {
     for "_j" from 0 to (_erc_numActions - 1) do
     {
       _menu =  _parent displayCtrl (1600 + _j + _numActions);
       _menu ctrlShow true;
       _config =  (_erc_cfgActions select _j);
       _text =  getText (_config >> "text");
       _script =  getText (_config >> "script");
       _height = _height + (0.025 * safezoneH);
       uiNamespace setVariable ['uiControl', _control];
       _menu ctrlSetText _text;
       _menu ctrlSetEventHandler ["ButtonClick",_script];
     };
   };

 

Can this not been done in one file?

I had a similar issue where 1 menu item has been overwritten so in between I've counted _numActions one up.

Maybe you need to enter such a line between the 2 parts.

I mean this:

_numActions = _numActions + 1;

 

Just a guess as it was an similar issue.

Link to comment
Share on other sites

  • 0

*EDIT* Got it working. I placed the code from the weapons attachments above the code for the other right click stuff and it works! :)

 

I figured out what is causing the problem. I have the weapons attachments mod installed. That adds the below code to the ui_selectSlot.hpp file:

    //### BEGIN MODIFIED CODE: extra click actions
	{
        private["_classname","_text","_execute","_condition"];
        _classname   = _x select 0;
        _text        = _x select 1;
        _execute     = _x select 2;
        _condition   = _x select 3;
        // if the clicked item matches, then assign the script call and display text
        if(_item == _classname && (call compile _condition)) then {
            _menu = _parent displayCtrl (1600 + _numActions);
            _menu ctrlShow true;
            _height = _height + (0.025 * safezoneH);
            uiNamespace setVariable ['uiControl', _control];
            _menu ctrlSetText _text;
            _menu ctrlSetEventHandler ["ButtonClick",_execute];
            _numActions = _numActions + 1;
        };
    } forEach DZE_CLICK_ACTIONS;
    //### END MODIFIED CODE: extra click actions   

Commenting that out makes the right click deploy work, but then the attachments right click doesn't work. So, I need to some how combine the above code with the below code:

   _erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
   _erc_numActions = (count _erc_cfgActions);
   if (isClass _erc_cfgActions) then {
     for "_j" from 0 to (_erc_numActions - 1) do
     {
       _menu =  _parent displayCtrl (1600 + _j + _numActions);
       _menu ctrlShow true;
       _config =  (_erc_cfgActions select _j);
       _text =  getText (_config >> "text");
       _script =  getText (_config >> "script");
       _height = _height + (0.025 * safezoneH);
       uiNamespace setVariable ['uiControl', _control];
       _menu ctrlSetText _text;
       _menu ctrlSetEventHandler ["ButtonClick",_script];
     };
   };

I also combined my watd.hpp with my extra_rc.hpp to make things simpler. 

Link to comment
Share on other sites

  • 0

It works on my test server, but when I tried putting it on my live Napf server, they both despawn. The variables.sqf are identical on both, as is the Infistar config. The old deploy script works fine on Napf with no despawn of the bike. I just tested it again on my test server. I deployed the bike, rode in circles, got off, just let it sit there and it never despawned.

Link to comment
Share on other sites

  • 0

*EDIT* Got it working. I placed the code from the weapons attachments above the code for the other right click stuff and it works! :)

 

I figured out what is causing the problem. I have the weapons attachments mod installed. That adds the below code to the ui_selectSlot.hpp file:

    //### BEGIN MODIFIED CODE: extra click actions
	{
        private["_classname","_text","_execute","_condition"];
        _classname   = _x select 0;
        _text        = _x select 1;
        _execute     = _x select 2;
        _condition   = _x select 3;
        // if the clicked item matches, then assign the script call and display text
        if(_item == _classname && (call compile _condition)) then {
            _menu = _parent displayCtrl (1600 + _numActions);
            _menu ctrlShow true;
            _height = _height + (0.025 * safezoneH);
            uiNamespace setVariable ['uiControl', _control];
            _menu ctrlSetText _text;
            _menu ctrlSetEventHandler ["ButtonClick",_execute];
            _numActions = _numActions + 1;
        };
    } forEach DZE_CLICK_ACTIONS;
    //### END MODIFIED CODE: extra click actions   

Commenting that out makes the right click deploy work, but then the attachments right click doesn't work. So, I need to some how combine the above code with the below code:

   _erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
   _erc_numActions = (count _erc_cfgActions);
   if (isClass _erc_cfgActions) then {
     for "_j" from 0 to (_erc_numActions - 1) do
     {
       _menu =  _parent displayCtrl (1600 + _j + _numActions);
       _menu ctrlShow true;
       _config =  (_erc_cfgActions select _j);
       _text =  getText (_config >> "text");
       _script =  getText (_config >> "script");
       _height = _height + (0.025 * safezoneH);
       uiNamespace setVariable ['uiControl', _control];
       _menu ctrlSetText _text;
       _menu ctrlSetEventHandler ["ButtonClick",_script];
     };
   };

I also combined my watd.hpp with my extra_rc.hpp to make things simpler. 

 

can you show your combined code? I am trying to do this aswell. lost my right click stuff in my extra_rc 

Link to comment
Share on other sites

  • 0

Which file are you talking about? The watd.hpp merged into the extra_rc.hpp?

 

 

After trial and error ive gotten it working, Im using another right click for extra_rc, which has right click options for fov, deploy, group management and some other stuff.

 

I was thinking I had to do it differently by merging the ui_selectslot.

 

//UI_SELECTSLOT.SQF LINE 57ish

// Add extra context menus
_erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
_erc_numActions = (count _erc_cfgActions);
if (isClass _erc_cfgActions) then {
for "_j" from 0 to (_erc_numActions - 1) do 
{
_menu =  _parent displayCtrl (1600 + _j + _numActions);
_menu ctrlShow true;
_config =  (_erc_cfgActions select _j);
_text =  getText (_config >> "text");
_script =  getText (_config >> "script");
_height = _height + (0.025 * safezoneH);
uiNamespace setVariable ['uiControl', _control];
_menu ctrlSetText _text;
_menu ctrlSetEventHandler ["ButtonClick",_script];
};
};
// End Add extra context menus
 
    //### BEGIN MODIFIED CODE: extra click actions
    {
        private["_classname","_text","_execute","_condition"];
        _classname   = _x select 0;
        _text        = _x select 1;
        _execute     = _x select 2;
        _condition   = _x select 3;
        // if the clicked item matches, then assign the script call and display text
        if(_item == _classname && (call compile _condition)) then {
            _menu = _parent displayCtrl (1600 + _numActions);
            _menu ctrlShow true;
            _height = _height + (0.025 * safezoneH);
            uiNamespace setVariable ['uiControl', _control];
            _menu ctrlSetText _text;
            _menu ctrlSetEventHandler ["ButtonClick",_execute];
            _numActions = _numActions + 1;
        };
    } forEach DZE_CLICK_ACTIONS;
    //### END MODIFIED CODE: extra click actions

here is the full uiselectslot

 

private ["_control","_button","_parent","_group","_pos","_item","_conf","_name","_cfgActions","_numActions","_height","_menu","_config","_type","_script","_outputOriented","_compile","_array","_outputClass","_outputType"];
disableSerialization;
_control =  _this select 0;
_button =   _this select 1;
_parent =   findDisplay 106;
 
//if ((time - dayzClickTime) < 1) exitWith {};
if (!DZE_SelfTransfuse && ((gearSlotData _control) == "ItemBloodBag")) exitWith {};
if (_button == 1) then {
    //dayzClickTime = time;
    _group = _parent displayCtrl 6902;
    
    _pos =      ctrlPosition _group;
    _pos set [0,((_this select 2) + 0.48)];
    _pos set [1,((_this select 3) + 0.07)];
    
    _item = gearSlotData _control;
    
    _conf = configFile >> "cfgMagazines" >> _item;
    if (!isClass _conf) then {
        _conf = configFile >> "cfgWeapons" >> _item;
    };
    _name = getText(_conf >> "displayName");
    
    _cfgActions = _conf >> "ItemActions";
    _numActions = (count _cfgActions);
    _height = 0;
    
    //Populate Menu
    for "_i" from 0 to (_numActions - 1) do 
    {
        _menu =     _parent displayCtrl (1600 + _i);
        _menu ctrlShow true;
        _config =   (_cfgActions select _i);
        _type =     getText (_config >> "text");
        _script =   getText (_config >> "script");
        _outputOriented =   getNumber   (_config >> "outputOriented") == 1;
        _height = _height + (0.025 * safezoneH);
        _compile =  format["_id = '%2' %1;",_script,_item];
        uiNamespace setVariable ['uiControl', _control];
        if (_outputOriented) then {
            /*
                This flag means that the action is output oriented
                the output class will then be transferred to the script
                && the type used for the name
            */          
            _array =    getArray    (_config >> "output");
            _outputClass = _array select 0;
            _outputType = _array select 1;
            _name = getText (configFile >> _outputType >> _outputClass >> "displayName");
            _compile =  format["_id = ['%2',%3] %1;",_script,_item,_array];
        };
        
        _menu ctrlSetText format[_type,_name];
        _menu ctrlSetEventHandler ["ButtonClick",_compile];
    };
// Add extra context menus
_erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
_erc_numActions = (count _erc_cfgActions);
if (isClass _erc_cfgActions) then {
for "_j" from 0 to (_erc_numActions - 1) do 
{
_menu = _parent displayCtrl (1600 + _j + _numActions);
_menu ctrlShow true;
_config = (_erc_cfgActions select _j);
_text = getText (_config >> "text");
_script = getText (_config >> "script");
_height = _height + (0.025 * safezoneH);
uiNamespace setVariable ['uiControl', _control];
_menu ctrlSetText _text;
_menu ctrlSetEventHandler ["ButtonClick",_script];
};
};
// End Add extra context menus
 
    //### BEGIN MODIFIED CODE: extra click actions
    {
        private["_classname","_text","_execute","_condition"];
        _classname   = _x select 0;
        _text        = _x select 1;
        _execute     = _x select 2;
        _condition   = _x select 3;
        // if the clicked item matches, then assign the script call and display text
        if(_item == _classname && (call compile _condition)) then {
            _menu = _parent displayCtrl (1600 + _numActions);
            _menu ctrlShow true;
            _height = _height + (0.025 * safezoneH);
            uiNamespace setVariable ['uiControl', _control];
            _menu ctrlSetText _text;
            _menu ctrlSetEventHandler ["ButtonClick",_execute];
            _numActions = _numActions + 1;
        };
    } forEach DZE_CLICK_ACTIONS;
    //### END MODIFIED CODE: extra click actions
 
    _pos set [3,_height];
    //hint format["Obj: %1 \nHeight: %2\nPos: %3",_item,_height,_grpPos];       
 
    _group ctrlShow true;
    ctrlSetFocus _group;
    _group ctrlSetPosition _pos;
    _group ctrlCommit 0;
};

 

 

 

The above code uses both extra_rc and the weapon mods.

 

I think you mentioned this in a previous post. to merge both right click menu's to work with one another.

 

 

To finalize this solution, I didnt delete me old ui_selectslot, but added to the weapon mods ui_selectslot the above code. Then what I had to do was remove inside of the overwrites folder the conflicting items.

DZE_CLICK_ACTIONS = [
    ["ItemGPS","Scan Nearby","if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_ZOMBIE_COUNT = count ((position player) nearEntities ['zZombie_Base',DZE_CLICK_ACTIONS_GPS_RANGE]); DZE_CLICK_ACTIONS_MAN_COUNT = count ((position player) nearEntities ['CAManBase',DZE_CLICK_ACTIONS_GPS_RANGE]);cutText[format['Within %1 Meters: %2 AI/players, %3 zombies, %4 vehicles',DZE_CLICK_ACTIONS_GPS_RANGE,DZE_CLICK_ACTIONS_MAN_COUNT - DZE_CLICK_ACTIONS_ZOMBIE_COUNT,count ((position player) nearEntities ['zZombie_Base',DZE_CLICK_ACTIONS_GPS_RANGE]),count ((position player) nearEntities ['allVehicles',DZE_CLICK_ACTIONS_GPS_RANGE]) - DZE_CLICK_ACTIONS_MAN_COUNT],'PLAIN DOWN'];","true"],
    ["ItemGPS","Range Up"   ,"if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_GPS_RANGE = (DZE_CLICK_ACTIONS_GPS_RANGE + 100) min 2500; cutText[format['GPS RANGE: %1',DZE_CLICK_ACTIONS_GPS_RANGE],'PLAIN DOWN'];","true"],
    ["ItemGPS","Range Down" ,"if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_GPS_RANGE = (DZE_CLICK_ACTIONS_GPS_RANGE - 100) max 1000;  cutText[format['GPS RANGE: %1',DZE_CLICK_ACTIONS_GPS_RANGE],'PLAIN DOWN'];","true"],
    ["ItemGPS","Toggle Map Marker","execVM 'overwrites\click_actions\examples\marker.sqf';","true"]
];
Link to comment
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
  • Discord

×
×
  • Create New...