Home   Help Search Login Register  

Author Topic: GDR script using XEH  (Read 1142 times)

0 Members and 1 Guest are viewing this topic.

Offline hamis

  • Members
  • *
  • I'm a llama!
GDR script using XEH
« on: 29 Oct 2008, 18:28:00 »
Well,is there a way to make this to work also then resuming mission:config.cpp
Code: [Select]
class CfgPatches {
class GDTModHDR {
units[] = {};
weapons[] = {};
requiredVersion = 0.14;
requiredAddons[] = {"Extended_EventHandlers"};
};
};

class Extended_Init_EventHandlers
{
class Man
{
GDTModHDR_Init_Man="_this execVM ""\GDTModHDR\GDTModHDR.sqf"";";
};
};
GDTModHDR.sqf:
Quote
sleep 1;
if (not (isnil ("GDTModHDRValue"))) ExitWith {};
GDTModHDRValue = -1;
Private["_keyspressed"];
setAperture GDTModHDRValue;
GDTModHDRKeypressed = compile preprocessFile "\GDTModHDR\GDTModHDRKey.sqf";
(findDisplay 46) displaySetEventHandler ["KeyDown","_this call GDTModHDRKeypressed"];
GDTModHDRKey.sqf:
Code: [Select]
if ((_this select 1) == 210) then
{
GDTModApertureValue = -1;
setAperture GDTModApertureValue;
hint "HDR ON";
};
if ((_this select 1) == 199) then
{
GDTModApertureValue = 50;
setAperture GDTModApertureValue;
hint "Day";
};
if ((_this select 1) == 207) then
{
GDTModApertureValue = 0.5;
setAperture GDTModApertureValue;
hint "Night";
};
if ((_this select 1) == 211) then
{
GDTModApertureValue = 4;
setAperture GDTModApertureValue;
hint "NVG";
};
if ((_this select 1) == 209) then
{
if (GDTModApertureValue <= 99.5) then
{
if (GDTModApertureValue < 0.5) then {GDTModApertureValue = 0;};
GDTModApertureValue = GDTModApertureValue + 0.5;
setAperture GDTModApertureValue;
};
};
if ((_this select 1) == 201) then
{
if (GDTModApertureValue > 0.5) then
{
GDTModApertureValue = GDTModApertureValue - 0.5;
setAperture GDTModApertureValue;
};
};

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: GDR script using XEH
« Reply #1 on: 29 Oct 2008, 19:43:07 »
I sorry but don't really understand what you are asking. I moved your post from where it was originally though, since it was clearly very off-topic.

I'll make some comments though:
* Read about why you shouldn't use preprocessFile ever again ;P
* You should consider using XEH 1.9 preinit handler. Saves messing around so much (OK, not complex, but saves running a script 1000 times a mission).
* You should definitely use either SPON Core key event handlers or Shole DEH Display event handlers rather than taking control of the key handler yourself (both are compatible with each other and better in different ways, so choose the one that suits you). Most scripts that use keys use one or the other of these to ensure compatibility and many people won't use an addon that is incompatible.
* Consider using a switch rather than lots of ifs to make things clearer.
« Last Edit: 29 Oct 2008, 19:45:44 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline hamis

  • Members
  • *
  • I'm a llama!
Re: GDR script using XEH
« Reply #2 on: 30 Oct 2008, 18:57:28 »
Well,this is GDTModHDR which disables terrible hdr lighting.It works only when you don't live the mission,if you quit and resume later it doesn't work.I want to know if it's possible to make it load everytime you load mission/savegame.I don't understand scripting much,so please answer very clearly.It can't be impossible,think about ECS which works all the time,whatever you do.
« Last Edit: 01 Nov 2008, 15:31:16 by hamis »