Jump to content
  • 0

Scroll Wheel View Distance


DAKA

Question

8 answers to this question

Recommended Posts

  • 0
On 20/8/2017 at 1:37 PM, DAKA said:

I'm looking for a way to set the view distance with just using the scroll wheel of your mouse. If someone has an option, please share. Thanks.

 

setviewmenu.sqf (mpmissions\your instance\scripts\ )

_STVIEW = 'setviewdistance %1;';

MainActionMenu =
[
	["",true],
		
		["View Distance>>", [], "#USER:STVIEW", -5, [["expression", ""]], "1", "1"],
            ["", [], "", -5, [["expression", ""]], "1", "0"],
            ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

STVIEW =
[
	["",true],
        ["250M", [2],  "", -5, [["expression", format[_STVIEW ,"250"]]], "1", "1"],
        ["500M", [3],  "", -5, [["expression", format[_STVIEW ,"500"]]], "1", "1"],
        ["750M", [4],  "", -5, [["expression", format[_STVIEW ,"750"]]], "1", "1"],
        ["1000M", [5],  "", -5, [["expression", format[_STVIEW ,"1000"]]], "1", "1"],
        ["1250M", [6],  "", -5, [["expression", format[_STVIEW ,"1250"]]], "1", "1"],
        ["1500M", [7],  "", -5, [["expression", format[_STVIEW ,"1500"]]], "1", "1"],
        ["1750M", [8],  "", -5, [["expression", format[_STVIEW ,"1750"]]], "1", "1"],
        ["2000M", [9],  "", -5, [["expression", format[_STVIEW ,"2000"]]], "1", "1"],
		["2250M", [10],  "", -5, [["expression", format[_STVIEW ,"2250"]]], "1", "1"],
		["2500M", [11],  "", -5, [["expression", format[_STVIEW ,"2500"]]], "1", "1"],
            ["", [-1], "", -5, [["expression", ""]], "1", "0"],
            ["Next page", [12], "#USER:STVIEW2", -5, [["expression", ""]], "1", "1"],
            ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];
STVIEW2 =
[
	["",true],
		["2750M", [2],  "", -5, [["expression", format[_STVIEW ,"2750"]]], "1", "1"],
        ["3000M", [3],  "", -5, [["expression", format[_STVIEW ,"3000"]]], "1", "1"],
        ["3250M", [4],  "", -5, [["expression", format[_STVIEW ,"3250"]]], "1", "1"],
        ["3500M", [5],  "", -5, [["expression", format[_STVIEW ,"3500"]]], "1", "1"],
        ["3750M", [6],  "", -5, [["expression", format[_STVIEW ,"3750"]]], "1", "1"],
        ["4000M", [7],  "", -5, [["expression", format[_STVIEW ,"4000"]]], "1", "1"],
		["4250M", [8],  "", -5, [["expression", format[_STVIEW ,"4250"]]], "1", "1"],
		["4500M", [9],  "", -5, [["expression", format[_STVIEW ,"4500"]]], "1", "1"],
		["4750M", [10],  "", -5, [["expression", format[_STVIEW ,"4750"]]], "1", "1"],
		["5000M", [11],  "", -5, [["expression", format[_STVIEW ,"5000"]]], "1", "1"],
            ["", [-1], "", -5, [["expression", ""]], "1", "0"],
            ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];


showCommandingMenu "#USER:MainActionMenu";

 

fn_selfactions.sqf

if (("Binocular_Vector" in _itemsPlayer) || ("Binocular" in _itemsPlayer)) then {
if (s_player_setview < 0) then {
_text = "SetView";
s_player_setview = player addAction [format["%1",_text], "\scripts\setviewmenu.sqf"];
		};
	} else {
		player removeAction s_player_setview;
		s_player_setview = -1;
	};

Note: cannot remember if binoculars are taked as _itemsPlayers or _magazinesPlayer

 

at least add

s_player_setview = -1;

in your custom variables.sqf  with the rest of actions.

Link to comment
Share on other sites

  • 0
Just now, DAKA said:

does it only work if you are looking through 


Binocular_Vector

no, you need a binocular vector or binoculars in your inventory to get the option.  if u dont want it.. skip the step in fn_selfactions  and create a new sqf. filled with this code.

setview_init.sqf

Spoiler

waituntil {!isnull (finddisplay 46)}; 
sleep 15;
setview = player addaction [("<t color=""#000000"">" + ("setview") +"</t>"),"scripts\setviewmenu.sqf","",5,false,true,"",""];

 

then at bottom of init.sqf paste:

//SET VIEW DISTANCE
[] execVM "scripts\setview_init.sqf";

 

by this way you dont need have binoculars , and you gonna have the option all time.

another way to do it.. ( i thiink the best..) is use a key to execute the set view menu)

Link to comment
Share on other sites

  • 0
Just now, WLF said:

How to make changing of a viewdistance by buttons, i.e. F6-increment (from 500m to 5000m), F5-decrement.

mmm dont know.. maybe something like...

up_vd.sqf

Spoiler

if(setviewdistance >=0 && setviewdistance <=549) then{
setviewdistance = 550;
systemchat "SetView550";
};

if(setviewdistance >=550 && setviewdistance <=749) then{
setviewdistance = 750;
systemchat "SetView750";
};                                                
                                                
if(setviewdistance >=750 && setviewdistance <=999 ) then{
setviewdistance = 1000;
systemchat "SetView1000";
};

if(setviewdistance >=1000 && setviewdistance <= 1499) then{
setviewdistance = 1500;
systemchat "SetView 1500";
};

if(setviewdistance >=1500 && setviewdistance <=1999) then{
setviewdistance = 2000;
systemchat "SetView 2000";
};

if(setviewdistance >=2000 && setviewdistance <=2999) then{
setviewdistance = 3000;
systemchat "SetView3000";
};

if(setviewdistance <=3000 && setviewdistance <=3999) then{
setviewdistance = 4000;
systemchat "SetView4000";
};

if(setviewdistance >=4000) then{
setviewdistance = 4000;
systemchat "SetView4000";
};

 

down_vd.sqf

Spoiler

if(setviewdistance >=3001 && setviewdistance <=4000) then{
setviewdistance = 3000;
systemchat "SetView3000";
};

if(setviewdistance >=2001 && setviewdistance <=3000 ) then{
setviewdistance = 2000;
systemchat "SetView2000";
};

if(setviewdistance >=1501 && setviewdistance <= 2000) then{
setviewdistance = 1500;
systemchat "SetView 1500";
};

if(setviewdistance >=1001 && setviewdistance <=1500) then{
setviewdistance = 1000;
systemchat "SetView 1000";
};

if(setviewdistance >=751 && setviewdistance <=1000) then{
setviewdistance = 750;
systemchat "SetView750";
};

if(setviewdistance <=501 && setviewdistance <=750) then{
setviewdistance = 500;
systemchat "SetView500";
};

if(setviewdistance <=500) then{
setviewdistance = 500;
systemchat "SetView500";
};

 

 

custom keyboard.sqf ( at bottom but before the last "_handled" )

if (_dikCode == 0x40) then {[] execVM "up_vd.sqf";};// F6 Key
if (_dikCode == 0x3F) then {[] execVM "down_vd.sqf";};// F5 Key

 

Link to comment
Share on other sites

  • 0
On 27.08.2017 at 2:30 AM, juandayz said:

mmm dont know.. maybe something like...

I did it this way:

down_vd.sqf:

Spoiler

private ["_vd"];
_vd = viewDistance;

if (_vd > 500) then {
	_vd = _vd - 100;
	if (_vd < 500) then {_vd = 500};
	setViewDistance _vd;
	systemchat format ["View distance = %1m", viewDistance];
};

 

up_vd.sqf:

Spoiler

private ["_vd"];
_vd = viewDistance;

if (_vd < 3500) then {
	_vd = _vd + 100;
	if (_vd > 3500) then {_vd = 3500};
	setViewDistance _vd;
	systemchat format ["View distance = %1m", viewDistance];
};

 

And also changed the dikcodes, because F5 used for groups:

keyboard.sqf:

Spoiler

if (_dikCode == 0x3E) then {[] execVM "viewDistance\up_vd.sqf";}; // F4 Key
if (_dikCode == 0x3D) then {[] execVM "viewDistance\down_vd.sqf";}; // F3 Key

 

 

Link to comment
Share on other sites

  • 0

@WLF very nice. Try use >= and <= to not get issues with 500 and 3500 values.

private ["_vd"];
_vd = viewDistance;

if (_vd <= 3499) exitWith {_vd = _vd + 100;setViewDistance _vd;systemchat format ["View distance = %1m", viewDistance];};
	
if (_vd >= 3500) exitWith {_vd = 3500;setViewDistance _vd;systemchat format ["View distance = %1m", viewDistance];};

 

private ["_vd"];
_vd = viewDistance;

if (_vd >= 500) exitWith{_vd = _vd - 100;setViewDistance _vd;systemchat format ["View distance = %1m", viewDistance];};
	
if (_vd <= 499) exitWith {_vd = 500;setViewDistance _vd;systemchat format ["View distance = %1m", viewDistance];};

 

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