Jump to content

Right Click/Change View Distance with RangeFinders


Friendly

Recommended Posts

  • 3 months later...

I've placed the code into my extra_rc.hpp file but I'm not getting a right click option with my Rangefinder.

 

Here is my extra_rc.hpp:

 

    class ExtraRc {


    class ItemKnife {
    class farmhemp {
    text = "Harvest the weed";
    script = "execVM 'custom\hemp.sqf'";
    };
    };
    class ItemKiloHemp {
    class smokeweed {
    text = "Smoke the shit";
    script = "execVM 'custom\smokeshit.sqf'";
    };
    };
    class Binocular_Vector  {
        class viewdistanceTitle {
            text = "View Distance:";
            script = "systemChat('Change View Distance Locally. Click on one of the distance options');";
        };
        class distance400m {
            text = "400 Meters";
            script = "setViewDistance 400; systemChat('ViewDistance: 400');";
        };
        class distance600m {
            text = "600 Meters";
            script = "setViewDistance 600; systemChat('ViewDistance: 600');";
        };
        class distance800m {
            text = "800 Meters";
            script = "setViewDistance 800; systemChat('ViewDistance: 800');";
        };
        class distance1000m {
            text = "1000 Meters";
            script = "setViewDistance 1000; systemChat('ViewDistance: 1000');";
        };
        class distance1250m {
            text = "1250 Meters";
            script = "setViewDistance 1250; systemChat('ViewDistance: 1250');";
        };
        class distance1500m {
            text = "1500 Meters";
            script = "setViewDistance 1500; systemChat('ViewDistance: 1500');";
        };
        class distance2000m {
            text = "2000 Meters";
            script = "setViewDistance 2000; systemChat('ViewDistance: 2000'); systemChat('Warning: Higher the view distance Lower the FPS');";
        };
        class distance3000m {
            text = "3000 Meters";
            script = "setViewDistance 3000; systemChat('ViewDistance: 3000'); systemChat('Warning: Higher the view distance Lower the FPS');";
        };
    };
    class Binocular {
        class viewdistanceTitle {
            text = "View Distance:";
            script = "systemChat('Change View Distance Locally. Click on one of the distance options');";
        };
        class distance400m {
            text = "400 Meters";
            script = "setViewDistance 400; systemChat('ViewDistance: 400');";
        };
        class distance600m {
            text = "600 Meters";
            script = "setViewDistance 600; systemChat('ViewDistance: 600');";
        };
        class distance800m {
            text = "800 Meters";
            script = "setViewDistance 800; systemChat('ViewDistance: 800');";
        };
        class distance1000m {
            text = "1000 Meters";
            script = "setViewDistance 1000; systemChat('ViewDistance: 1000');";
        };
        class distance1250m {
            text = "1250 Meters";
            script = "setViewDistance 1250; systemChat('ViewDistance: 1250');";
        };
        class distance1500m {
            text = "1500 Meters";
            script = "setViewDistance 1500; systemChat('ViewDistance: 1500');";
        };
        class distance2000m {
            text = "2000 Meters";
            script = "setViewDistance 2000; systemChat('ViewDistance: 2000'); systemChat('Warning: Higher the view distance Lower the FPS');";
        };
        class distance3000m {
            text = "3000 Meters";
            script = "setViewDistance 3000; systemChat('ViewDistance: 3000'); systemChat('Warning: Higher the view distance Lower the FPS');";
        };
    };
    };

 

I checked my RPT but found nothing related to this.

 

Am I maybe not placing it in the right section of file? Or maybe brackets are wrong?

 

Edit: I tried using the separate script provided by Calamity and that doesn't work either.

 

I have "BLOCK ALL CMDMenus" set to false in my Infistar config.

 

Thank you.

Link to comment
Share on other sites

  • 4 weeks later...

I've placed the code into my extra_rc.hpp file but I'm not getting a right click option with my Rangefinder.

 

Here is my extra_rc.hpp:

 

    class ExtraRc {

    class ItemKnife {

    class farmhemp {

    text = "Harvest the weed";

    script = "execVM 'custom\hemp.sqf'";

    };

    };

    class ItemKiloHemp {

    class smokeweed {

    text = "Smoke the shit";

    script = "execVM 'custom\smokeshit.sqf'";

    };

    };

    class Binocular_Vector  {

        class viewdistanceTitle {

            text = "View Distance:";

            script = "systemChat('Change View Distance Locally. Click on one of the distance options');";

        };

        class distance400m {

            text = "400 Meters";

            script = "setViewDistance 400; systemChat('ViewDistance: 400');";

        };

        class distance600m {

            text = "600 Meters";

            script = "setViewDistance 600; systemChat('ViewDistance: 600');";

        };

        class distance800m {

            text = "800 Meters";

            script = "setViewDistance 800; systemChat('ViewDistance: 800');";

        };

        class distance1000m {

            text = "1000 Meters";

            script = "setViewDistance 1000; systemChat('ViewDistance: 1000');";

        };

        class distance1250m {

            text = "1250 Meters";

            script = "setViewDistance 1250; systemChat('ViewDistance: 1250');";

        };

        class distance1500m {

            text = "1500 Meters";

            script = "setViewDistance 1500; systemChat('ViewDistance: 1500');";

        };

        class distance2000m {

            text = "2000 Meters";

            script = "setViewDistance 2000; systemChat('ViewDistance: 2000'); systemChat('Warning: Higher the view distance Lower the FPS');";

        };

        class distance3000m {

            text = "3000 Meters";

            script = "setViewDistance 3000; systemChat('ViewDistance: 3000'); systemChat('Warning: Higher the view distance Lower the FPS');";

        };

    };

    class Binocular {

        class viewdistanceTitle {

            text = "View Distance:";

            script = "systemChat('Change View Distance Locally. Click on one of the distance options');";

        };

        class distance400m {

            text = "400 Meters";

            script = "setViewDistance 400; systemChat('ViewDistance: 400');";

        };

        class distance600m {

            text = "600 Meters";

            script = "setViewDistance 600; systemChat('ViewDistance: 600');";

        };

        class distance800m {

            text = "800 Meters";

            script = "setViewDistance 800; systemChat('ViewDistance: 800');";

        };

        class distance1000m {

            text = "1000 Meters";

            script = "setViewDistance 1000; systemChat('ViewDistance: 1000');";

        };

        class distance1250m {

            text = "1250 Meters";

            script = "setViewDistance 1250; systemChat('ViewDistance: 1250');";

        };

        class distance1500m {

            text = "1500 Meters";

            script = "setViewDistance 1500; systemChat('ViewDistance: 1500');";

        };

        class distance2000m {

            text = "2000 Meters";

            script = "setViewDistance 2000; systemChat('ViewDistance: 2000'); systemChat('Warning: Higher the view distance Lower the FPS');";

        };

        class distance3000m {

            text = "3000 Meters";

            script = "setViewDistance 3000; systemChat('ViewDistance: 3000'); systemChat('Warning: Higher the view distance Lower the FPS');";

        };

    };

    };

 

I checked my RPT but found nothing related to this.

 

Am I maybe not placing it in the right section of file? Or maybe brackets are wrong?

 

Edit: I tried using the separate script provided by Calamity and that doesn't work either.

 

I have "BLOCK ALL CMDMenus" set to false in my Infistar config.

 

Thank you.

 

Bump

Link to comment
Share on other sites

I finally figured out what my problem was.

 

I had 2 extra_rc.hpp files.

 

I was actually using one that was added with alchemical crafting but I was trying to edit the original one I had for hemp script so I removed the old hemp extra_rc.hpp & added the viewdistance code to the other extra_rc.hpp and it works fine.

Link to comment
Share on other sites

  • 1 year later...
16 minutes ago, harcosgoogle said:

maca right click install link removed

open your custom ui_selectslot.sqf

find:

_pos set [3,_height];

above it paste:

Spoiler

_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];
      };
   };

 

open your description.ext.

at very bottom paste:

//clickright
#include "custom\extra_rc.hpp"

now into mpmissions\yourinstance\custom\  create a new .hpp called  extra_Rc.hpp

extra_Rc.hpp

Spoiler

class ExtraRc {
  class Binocular {
     class setview1 {
        text = "250mts";
        script = "execVM 'custom\scripts\setview\250.sqf'";
     };
     class setview2 {
        text = "500mts";
        script = "execVM 'custom\scripts\setview\500.sqf'";
     };
     class setview3 {
        text = "1000mts";
        script = "execVM 'custom\scripts\setview\1000.sqf'";
     };
     class setview4 {
        text = "1500mts";
        script = "execVM 'custom\scripts\setview\1500.sqf'";
     };
  };
 
};

 

mpmissions\yourinstance\custom\scripts\setview\ http://www.mediafire.com/file/pdykr9ua4oq3e34/setview.rar

 

Link to comment
Share on other sites

40 minutes ago, harcosgoogle said:

@juandayz 

 

how to add Rangefinder?

 


class Binocular and Rangefinder

extra_rch.hpp

Spoiler

class ExtraRc {
  class Binocular {
     class setview1 {
        text = "250mts";
        script = "execVM 'custom\scripts\setview\250.sqf'";
     };
     class setview2 {
        text = "500mts";
        script = "execVM 'custom\scripts\setview\500.sqf'";
     };
     class setview3 {
        text = "1000mts";
        script = "execVM 'custom\scripts\setview\1000.sqf'";
     };
     class setview4 {
        text = "1500mts";
        script = "execVM 'custom\scripts\setview\1500.sqf'";
     };
  };
  
  class Binocular_Vector {
     class setview5 {
        text = "250mts";
        script = "execVM 'custom\scripts\setview\250.sqf'";
     };
     class setview6 {
        text = "500mts";
        script = "execVM 'custom\scripts\setview\500.sqf'";
     };
     class setview7 {
        text = "1000mts";
        script = "execVM 'custom\scripts\setview\1000.sqf'";
     };
     class setview9 {
        text = "1500mts";
        script = "execVM 'custom\scripts\setview\1500.sqf'";
     };
  };
 
};

 

 

Link to comment
Share on other sites

 

ui_selectSlot.sqf

//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 (carryClick) then {carryClick = false;};

if (_button == 1) then {
	private ["_conf","_name","_compile","_height","_item"];
	_group = _parent displayCtrl 6902;

	_pos = ctrlPosition _group;

	_item = gearSlotData _control;	
	if ( //No right click action
		(!DZE_SelfTransfuse && _item in ["ItemBloodbag","wholeBloodBagANEG","wholeBloodBagAPOS","wholeBloodBagBNEG","wholeBloodBagBPOS","wholeBloodBagABNEG","wholeBloodBagABPOS","wholeBloodBagONEG","wholeBloodBagOPOS"]) or
		(!dayz_groupSystem && _item == "ItemRadio")
	) exitWith {};
	if (mouseOverCarry) then {
		_item = DayZ_onBack;
		carryClick = true;
	};

	_pos set [0,((_this select 2) + 0.46)];
	_pos set [1,((_this select 3) + 0.07)];

	_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
				and 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];
	};
	
	
	
	
	//### 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
	
	
	
	_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];
      };
   };
	_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;
};

 

Link to comment
Share on other sites

 

5 hours ago, harcosgoogle said:

i'm not move --DayZ_Epoch_24.Napf/dayz_code (not pbo)

 


I do not know where to find it custom com piles?

ok to get it work,, first you will need made a custom compiles.sqf

Open your \@DayZ_Epoch\addons\dayz_code\init\  and drop compiles.sqf  into mpmissions\the instance that youre using\custom\

The same for ui_selectslot.sqf  open \@DayZ_Epoch\addons\dayz_code\compile\ and drop ui_selectslot.sqf into mpmissions\the instance that youre using\custom\

Now open init.sqf

find ths line:

call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";

change by:

call compile preprocessFileLineNumbers "custom\compiles.sqf";

At least open your new custom compiles.sqf (located in custom folder)

find this line:

player_selectSlot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_selectSlot.sqf";

replace by:

player_selectSlot = compile preprocessFileLineNumbers "custom\ui_selectSlot.sqf";

And now you can make the changes into this new ui_selectslot.sqf.

For other mods, you will need know that any kind of changes that you realize into dayz_code do not suffer effect. You need drop the files located in this path out of here, and place into mpmissions\your instance\ or into dayz_server.pbo.  and change the paths in a custom compiles.sqf/fn_Selfactions/or init.sqf.

You can learn a lil more from here

Spoiler

 

 

Link to comment
Share on other sites

  • 2 weeks later...

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...