Jump to content
Sign in to follow this  
Solus

Extended eventhandlers

Recommended Posts

One such addon is the DMHide addon.

Thank you! It was exactly this addon, pretty embarassing I didn't figure it myself considering I currently have only 3 addons in my modfolder rofl.gif

Share this post


Link to post
Share on other sites

Hi,

I think I've hit an obscure problem with the Extended eventhandlers? From what I've seen so far, it's this line in init.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// If it's a vehicle then start event handlers for the crew.

if(!(_unit isKindOf "Man"))then

I say I think it's that line, not had chance to narrow it down further. But it's possible to have objects as vehicle crew, that are not IskindOf "Man". Game Logics or any class (below Man) that can support simulation="Soldier".

If I move 8 game logics into the back of a 5 ton truck, I get a drop of 20fps until they are moved out again. Remove the extended addon pbo, it then works ok.

I added some debug info into the Init and SLX_Init_Other_All events, for the handlers config. It looks like both those events are called every 0.2 seconds, repeatedly, for every game logic that remains in a vehicles crew.

Can someone confirm this?

Cheers

Share this post


Link to post
Share on other sites

I'm currently trying to reproduce the problem. Could you PM me the test mission and details of the changes you've made to the XEH addon? (Or just present the details here of course, if they're not too extensive)

Share this post


Link to post
Share on other sites
Quote[/b] ]I'm currently trying to reproduce the problem.

Cheers,

I don't have access to my ARMA PC atm, so I can't post the test mission. But basicly, I put a manned (AI) URAL on the main airport and named it U01. Then placed eight Game Logics on the map, with this line in thier init fields:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This MoveInCargo U01

The changes to the pbo were simple, I just added the following lines to the scripts called by the Init and SLX_Init_Other_All events.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Localize Format ["Init %1",Time];

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Localize Format ["SLX_Init_Other_All %1",Time];

That should now write to Arma.rpt every time they are launched.

Sorry I cant send you both the test mission and addon atm, if you don't mind waiting a few days? I will send them as soon as I get the chance.

Share this post


Link to post
Share on other sites

Eek - no worries - I can see the problem now.  Gimme a yey for infinite recursion! crazy_o.gif  (And the culprit is indeed the "isKindOf" check) Ok, I'll look into this...

EDIT: So far, I've come up with two candidate fixes:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// If it's a vehicle then start event handlers for the crew.

_sim=getText(configFile/"CfgVehicles"/_unitClass/"simulation");

if  ({_sim==_x}count["soldier","invisible"]==0) then

{

   ...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// If it's a vehicle then start event handlers for the crew.

if ({_unit isKindOf _x} count ["Man","Logic"]==0) then

{

   ...(I'm throwing them out here for peer review to see if anyone can come up with a situation where these would break XEH before I issue an update)

Share this post


Link to post
Share on other sites
guess it's time to ask about XEH to be 'expanded or merged' with :

http://www.ofpec.com/forum/index.php?topic=31384.0

I don't see any real need to merge the two. They are really two completely different things in my opinion so merging them really doesn't buy you anything and is probably more of a negative in terms of maintenance etc.

Share this post


Link to post
Share on other sites
Quote[/b] ]Gimme a yey for infinite recursion!

Lol

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// If it's a vehicle then start event handlers for the crew.

_sim=getText(configFile/"CfgVehicles"/_unitClass/"simulation");

if ({_sim==_x}count["soldier","invisible"]==0) then

That looks like a water tight solution. I don't think you can have any other simulations in a vehicles cargo position?

Cheers

Share this post


Link to post
Share on other sites
guess it's time to ask about XEH to be 'expanded or merged' with :

http://www.ofpec.com/forum/index.php?topic=31384.0

Ah yes, I saw that one recently. Spooner has a similar thing in his SPON Core (and the latter is apparently compatible with Shole's version as of SPON_Core 0.5.1). Without making any promises either way, let's just say that I'm currently doing some research related to a possible general display event handler framework for XEH...

Getting back to the XEH of today, I've made a few fixes to it that solves the performance drop UNN reported when game logics are inside a vehicle, so here goes:

Extended Eventhandlers 1.8 (23 KiB)

Changelog

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">XEH Change log

==============

1.8 (Sep 7, 2008)

Fixed: game logics inside vehicles would cause a performance drop due to a

      infinite recursion in the code that handles initialisation of

      vehicle crews. Thanks to UNN for the bug report!

Added: you can make XEH init event handlers execute when players respawn by

      using an inner XEH class and the "onRespawn" boolean property.

1.7 (Mar 16, 2008)

Fixed: Removed XEH from class Static, which stops ArmA from crashing to desktop

      when resuming saved games.

1.6 (Mar 15, 2008)

Fixed: The "exclude" property will apply to the specified class(es) and all

      subclasses thereof.

1.5 (Mar 15, 2008)

Added: Composite ("inner") XEH classes can have an extra property, "exclude"

      which is either a string or an array of strings with the class name(s)

      of vehicles that should *not* get a particular XEH event handler.

1.4 (Mar 15, 2008)

Added: "Static" class vehicles can now have XEH event handlers.

Added: A respawn monitor that restores non-init XEH event handlers after

      the player respawns. Many thanks to Sickboy, LoyalGuard, ViperMaul for

      the initial research and suggestions!

1.3 (Feb 9, 2008)

Added: The ability to use "nested" XEH classes with a "scope" feature

      to limit certain event handlers to objects of specific classes.

1.2 (Jan 29, 2008)

Fixed: SightAdjustment_AutoInit.

Fixed: Extended Dammaged EventHandler.

1.1 (Jan 26, 2008)

Fixed: XEH can now handle extended event handlers that are missing a trailing

      semicolon.

Fixed: the example addons now require the Extended_Eventhandlers addon instead

      of the two older ones. Also, the debug sideChats are now guaranteed to

  be seen when previewing a mission with the example addons loaded.

Fixed: XEH init EH:s are now actually being called on units inside vehicles.

1.0 Initial Release (Dec 31, 2007)

Combined Extended Init, Fired, and Other event handlers. Thanks to Killswitch

for combining them and adding the other extended event handlers!

Added signature and bikey.Let's say we think of this as a semi-final 1.8, and if, in a day or so, no showstopper oddities resulting from the fix should appear, we'll call it done and I'll contact the big-name mirrors for, well, mirroring.  smile_o.gif

Share this post


Link to post
Share on other sites

@Killswitch

Thanks for the quick update.

A bit to quick smile_o.gif I was going to suggest adding a stringtable entry, with something like this in it:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">STR_XEH_VERSION,"1.8",,,,,,,

Just so we can detect the correct version via a script, using Localize. Not a big deal, but if your are happy to inclue it, if and when you do another update. That would be great.

Cheers

Share this post


Link to post
Share on other sites
@Killswitch

Thanks for the quick update.

A bit to quick smile_o.gif I was going to suggest adding a stringtable entry, with something like this in it:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">STR_XEH_VERSION,"1.8",,,,,,,

Just so we can detect the correct version via a script, using Localize. Not a big deal, but if your are happy to inclue it, if and when you do another update. That would be great.

Cheers

That's a good idea for a future version. For now, you can do it via the "undocumented" variant:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (isClass (configFile/"CfgPatches"/"Extended_EventHandlers")) then

{

   _version=getNumber(configFile/"CfgPatches"/"Extended_EventHandlers"/"SLX_XEH2_Version");

   hint format ["Extended Eventhandlers is version %1",_version];

};

Share this post


Link to post
Share on other sites

With the new version seems to be problems with the ECS-Mod admit. ECS will not start more complete.

Maybe the problem is also a member of the ECS EventHandler (Themis.pbo)

Greetings BlackSheep

Share this post


Link to post
Share on other sites
Quote[/b] ]With the new version seems to be problems with the ECS-Mod admit. ECS will not start more complete.

I  have to say this is true,my ecs didn't initialize with new version! crazy_o.gif

Share this post


Link to post
Share on other sites

Thanks for the mirroring!

Regarding ECS - I can confirm that ECS fails to load properly with the new version of Extended Eventhandlers. I had a look at their(?) bridge addon, "Themis.pbo" and the XEH support is done in a slightly "unsupported" way.

The proper way to do it would be to have a config like looks like this: config.cpp.

EDIT: I've reported the problem in the ECS forums aswell. Here's hoping they'll issue a fixed "Themis.pbo"... smile_o.gif

Share this post


Link to post
Share on other sites

Sorry to say, but

it looks like that there won't be coming anything more for ArmA from the ECS - Team:

We are sad to say that development on ECS has ended , due to a lack of time and interest in ArmA in general, and that support will also no longer be available.

We were very happy to share our efforts with the community though it was primarily created for our use, and hope to someday resurrect the project.

We also look forward to see what ArmA II has in store for the future and hope we may see our old friends again there too.

ECS - forum - post

Share this post


Link to post
Share on other sites

I was reading in an other post (Don`t know wich 1 anymore) and somebody was telling :

Quote[/b] ]Do this:

1. Download the latest Extended Event Handlers

2. Remove all eventhandlers you have in all your modfolders.

3. Make a new modfolder called @XEH (make sure to make another folder inside that folder called "addons". Put the 2 XEH files in there.

4. Add the @XEH modfolder LAST in your modline.

must i delete every file that has XEH in it ? or only eventhandlers ?

Share this post


Link to post
Share on other sites
I was reading in an other post (Don`t know wich 1 anymore) and somebody was telling :
Quote[/b] ]Do this:

1. Download the latest Extended Event Handlers

2. Remove all eventhandlers you have in all your modfolders.

3. Make a new modfolder called @XEH (make sure to make another folder inside that folder called "addons". Put the 2 XEH files in there.

4. Add the @XEH modfolder LAST in your modline.

must i delete every file that has XEH in it ? or only eventhandlers ?

okè i figure it out ,that works

and what about the ECS .. the stopped with supporting and further i presume ..so i am thinking to not use ECS anymore confused_o.gif

Share this post


Link to post
Share on other sites

Hi,

I want to be able to autodetect the Extended Event Handler, rather than adding it as a required addon. So I came up with this:

Test_Addon.pbo:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

       {

       class Test_Addon

               {

               units[] = {Test};

               weapons[] = {};

               requiredVersion = 1.08;

               requiredAddons[] = {};

               };

       };

class Extended_Init_EventHandlers

       {

       class Test

               {

               Test_init="[_This Select 0,True] Call Compile PreProcessFile ""\Test_Addon\s\TestInit.sqf""";

               };

       };

class cfgVehicles

       {

       class SoldierWB;

       class Test : SoldierWB

               {

               class EventHandlers

                       {

                       init="[_This Select 0] Call Compile PreProcessFile ""\Test_Addon\s\TestInit.sqf""";

                       };

               };

       };

TestInit.sqf has the following at the start:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_unit","_sp"];

_Unit=_This Select 0;

//If the Extended init event handler addon is installed then use it else continue

If ((isClass (configFile >> "Extended_EventHandlers")) And ((Count _This)==1)) ExitWith

       {

       _sP=[_Unit,"Extended_Init_EventHandlers"] call compile preprocessFile "\Extended_EventHandlers\Init.sqf";

       };

I think the only real difference is that class EventHandlers does not inherit from Extended_EventHandlers. Which is fine for me as the rest of the events are assigned using scripts.

It seems to work ok, I just wondered if it had the potential to mess up other addons using the handler?

Cheers

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×