Home   Help Search Login Register  

Author Topic: Menu in center mouse wheel in game  (Read 2014 times)

0 Members and 1 Guest are viewing this topic.

Menu in center mouse wheel in game
« on: 09 Jun 2009, 16:21:43 »
Hi: I have a small problem. I have a script I am using InstantViewDistance. My problem is that after (X) # of deaths the option to use InstantViewDistance disapears from your center mouse wheel menu. Now this is exec by an addons folder not in the map and there is a reason for this, I am disabled and players help me with the server price so I have added to this addon, vehicle sqf's so that any1 that is a paid member to the server are the only ones to get this menu and with setting thier view distance at will they can build vehicles of thier choice at will. yes I know if I add this to the map it will stay always, BUT then any1 that joins the server can get this menu and it is for paid members. Not to be mean to non members but it is a little extra something for those who wish to help with the server cost. there are vehicles on the map that non members can get and have to drive to cities.  Here is what I have if anyone can please help me so the menu stays no matter how many times you die.    ( config.cpp )
Code: [Select]
#define true 1
#define false 0


class CfgPatches
{
class InstantViewDistance
{
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {"CAWeapons", "CATracked", "CAWheeled", "CAAir", "CAWater"};
};
};




class CfgVehicles
{

class Land;

class Man : Land
{
class UserActions
{
class InstantViewDistance_Init
{
displayName="InstantViewDistance";
position="pos driver";
onlyforplayer=1;
radius=200000.0;
condition="(this == player) && (isnil ""executed"")";
statement="[] execVM ""\InstantViewdistance\scripts\viewdistance.sqf"";executed = 1;";
};
};
};
};
then I have a scripts folder with ( settingsfinished.sqf )
Code: [Select]
waituntil {alive player};

player removeAction InstantViewDistance;
player removeAction viewdistup;
player removeAction viewdistdown;
player removeAction airviewdistup;
player removeAction airviewdistdown;
player removeAction terrlow;
player removeAction terrmid;
player removeAction terrhigh;
player removeAction finished;

InstantViewDistance = player addaction ["InstantViewDistance", "instantviewdistance\scripts\viewdistance.sqf",80,1, false, true, "test2"];
( viewdistance.sqf )
Code: [Select]
vdist=1200;
avdist=1200;

player removeAction InstantViewDistance;
player removeAction viewdistup;
player removeAction viewdistdown;
player removeAction airviewdistup;
player removeAction airviewdistdown;
player removeAction terrlow;
player removeAction terrmid;
player removeAction terrhigh;
player removeAction finished;

  viewdistup = player addaction ["ViewDistance Up", "instantviewdistance\scripts\viewdistancesettings.sqf",10,1, true, true,"test2"];
viewdistdown = player addaction ["ViewDistance Down", "instantviewdistance\scripts\viewdistancesettings.sqf",20,1, true, true,"test2"];
airviewdistup = player addaction ["AirViewDistance Up", "instantviewdistance\scripts\viewdistancesettings.sqf",60,1, true, true,"test2"];
airviewdistdown = player addaction ["AirViewDistance Down", "instantviewdistance\scripts\viewdistancesettings.sqf",70,1, true, true,"test2"];
terrlow = player addaction ["TerrainDetail Low", "instantviewdistance\scripts\viewdistancesettings.sqf",30,1, true, true,"test2"];
terrmid = player addaction ["TerrainDetail Medium", "instantviewdistance\scripts\viewdistancesettings.sqf",40,1, true, true,"test2"];
terrhigh = player addaction ["TerrainDetail High", "instantviewdistance\scripts\viewdistancesettings.sqf",50,1, true, true,"test2"];
finished = player addaction ["ViewDistance Finished", "instantviewdistance\scripts\settingsfinished.sqf",80,1, true, true, "test2"];

player addEventHandler ["killed",{[_this] execVM "instantviewdistance\scripts\settingsfinished.sqf";}];
( viewdistancesettings.sqf )
Code: [Select]
_var = _this select 3;
hint format["%1",_varar];

if(_vara == 1 and varb == 0) then
{
setViewDistance (vdist+100);
vdist = vdist+100;
hint format["ViewDistance %1",vdist]
};

if(_var == 10) then {setViewDistance vdist+100;vdist = vdist+100;hint format["View Distance set to %1m",vdist]};
if(_var == 20) then {setViewDistance vdist-100;vdist = vdist-100;hint format["View Distance set to %1m",vdist]};
if(_var == 30) then {setterraingrid 50;hint "Terrain Detail set to Low"};
if(_var == 40) then {setterraingrid 25;hint "Terrain Detail set to Medium"};
if(_var == 50) then {setterraingrid 12.5;hint "Terrain Detail set to High"};
if(_var == 60) then {avdist = avdist+100;hint format["Aircraft View Distance set to %1m",avdist]};
if(_var == 70) then {avdist = avdist-100;hint format["Aircraft View Distance set to %1m",avdist]};
//tgrid=50;
//vdist=900;

If anyone can help me, What do I need to add/subtract from either/all of these scripts to make the menu show up every time you die? As I said, right now the menu is there at start of game and some times you die once it disapears, some times you  die 3 times b4 it disapears, some times 5 times. But it always disapears right now as codes are and you have to exit the game and rejoin to get the menu back. PLEASE HELP, Thanx Robert.
« Last Edit: 09 Jun 2009, 16:44:47 by SpectrumWarrior »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Menu in center mouse wheel in game
« Reply #1 on: 13 Jun 2009, 18:57:37 »
Why do you remove the event handlers when someone gets killed? According to this page it's not necessary.
try { return true; } finally { return false; }

Re: Menu in center mouse wheel in game
« Reply #2 on: 14 Jun 2009, 21:55:52 »
?)   I only see an addeventhandler, not a remove eventhandler

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Menu in center mouse wheel in game
« Reply #3 on: 14 Jun 2009, 23:48:34 »
Uhm... oops! Looks like I mixed up EHs and actions.  :weeping:

Edit: I took a close look at it again. Feel free to ignore the first two points (err, wait... feel free to ignore them all! *g*):

1. You shouldn't use globals without a tag.
2. You should declare _var in viewdistancesettings.sqf private. Failing to do so can lead to subtile bugs that are _very_ hard to track down.
3. Just adding event handlers is probably not what you want:
if you add an event handler of type "killed" and there already exists one, the old one doesn't get overwritten.
in ArmA a respawned unit still has the EHs it had before
4. The VD is reset every time viewdistance.sqf is called. This will annoy some people for sure.
« Last Edit: 15 Jun 2009, 00:39:35 by Worldeater »
try { return true; } finally { return false; }

Re: Menu in center mouse wheel in game
« Reply #4 on: 15 Jun 2009, 08:22:35 »
O.K. not to sound dumb, but I do not know how to write scripts. I only know how to edit some scripts to what I wish it to do. For instance I took the original evo3.0 and edited it to 25 cities, triple the men spawning in towns and extra su34's and ka50's, because I got tired of seening everyone making it easier with nuks and chit. I call it operation EAW ( evolution a$$ whooping ) because you WILL get your a$$ whooped in it lol. This instantviewdistance  script I have had laying around for 2 years I found on a forum somewhere, and it has always had this bug of disapearing after X number of deaths. I have no clue who even wrote this script to ask them how to fix it. Now I am tryin to understand what you are saying to me here, but the only part I get is the part about two eventhandlers counter acting each other. So in closing I realy have no clue what you are telling me to add or subtract from either of these scripts to make it stop disapearing from the menu. I have tried countless numbers of things from what I have learned from my extent of editing knowledge to no avail.
Quote
4. The VD is reset every time viewdistance.sqf is called. This will annoy some people for sure.
No, because as I said everyone gets thier own ivd addon seperately. So in the viewdistance.sqf I preset each persons default distance to what they want so when they activate the menu and then close it it sets it's self to thier default choice.
 Because as I said b4
Quote
I have added to this addon, vehicle sqf's so that any1 that is a paid member to the server are the only ones to get this menu and with setting thier view distance at will they can build vehicles of thier choice at will.
So it is not the ivd that really even matters here it is the building vehicles that matters but I need the dadblame menu to stop disapearing when you die lol
« Last Edit: 15 Jun 2009, 08:36:11 by SpectrumWarrior »