Page MenuHomeFeedback Tracker

displayAddEventHandler stops working after loading a saved game.
Closed, ResolvedPublic

Description

I tried searching everywhere for this but did not come up with any info on it.
The display handler is gone after loading a saved game.
if (!isDedicated) then {

waitUntil {!(IsNull (findDisplay 46))};

(findDisplay 46) displayAddEventHandler ["KeyDown", "_this call XS_KeyHandler;"];
};
Tried it in single player and multiplayer, with modded and a clean version of stable arma 3. same issue no mater what i try, and it allays happen without fail. is this a bug or I'm misunderstanding how this is suppose to work.

Details

Legacy ID
1927485979
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce
  1. open a game with debugging.
  2. run the code
  3. spawn {XS_counter = 0; (findDisplay 46) displayAddEventHandler ["KeyDown", "hint format [""working:%1"",XS_counter];XS_counter = XS_counter +1;"];};
  4. press any key to check if it works. A hint will appear counting every key press or while holding any key down it will continue counting.
  5. Save&Exit game.
  6. Load game.
  7. Try pressing any button and you should see that it no longer works.

Event Timeline

xagen edited Steps To Reproduce. (Show Details)Jan 17 2016, 12:00 PM
xagen set Category to Scripting.
xagen set Reproducibility to Always.
xagen set Severity to None.
xagen set Resolution to No Bug.
xagen set Legacy ID to 1927485979.May 8 2016, 1:30 PM

Is it supposed to save or was this possible before? UI elements cannot be serialized, this is why there is even disableSerialization command. The display you are attaching EH to cannot be saved therefore EH will not save.

xagen added a subscriber: xagen.May 8 2016, 1:30 PM
xagen added a comment.Jan 17 2016, 1:07 PM

So basically if it's not suppose to save, i need to re-init it after a load somehow?

You can use "Loaded" EH to detect mission loading from save https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Loaded

xagen added a comment.Jan 17 2016, 3:14 PM

Got it to work with addMissionEventHandler "Loaded"