Before I tell you what inGameUISetEventHandler does, I want to say special thanks to Andrew for his support. In case you’re wondering, yeah, it is THAT Andrew :). Thanks dude, appreciated!

So, inGameUISetEventHandler. The purpose of it eluded me for quite sometime and lack of documentation made it worse. It is time to change all that! As you have probably guessed it is a command to set up some kind of Event Handler. And as with any “set” event handler command it will overwrite previously set EH of the same type. It is also quite ancient, because it takes STRING for the code, nevertheless fully functional. This is the format:

  • inGameUISetEventHandler [EHType:<STRING>, Code:<STRING>]

It returns NOTHING and there are only 3 EHTypes it supports:

  • PrevAction
  • Action
  • NextAction

All of which have everything to do with action menu. So when you scroll mouse wheel UP, “PrevAction” EH is triggered, DOWN, “NextAction” EH is triggered, when you perform ACTION (which is default mapped to Enter, and not the Spacebar), “Action” EH is triggered.

There is no param passed to the code in any case. You might ask, what is the point, you can already detect mouse wheel with “onMouseZChanged” UI EH, and detect Action Key press with a UI EH as well as inputAction command? Well, what if I told you that the most value in these InGameUI EHs is an ability to override default behaviour?

The code added to inGameUISetEventHandler is expected to return BOOLEAN. If nothing is returned it is treated as false. If true is returned, then this will essentially cancel your UI action. Off top of my head, there are immediately 2 cases where I could use this. First is to disable action menu without disabling HUD. Disabling HUD with showHUD false, disables action menu but it also disables other HUD elements which you might want to keep enabled. So to disable action menu only:

inGameUISetEventHandler ["PrevAction", "true"]; inGameUISetEventHandler ["NextAction", "true"];

Now as for “Action” EH, it will only disable Enter key action (and some other keys if you have ACTION mapped to other keys as well). However disabling “Action” actually frees ACTION key for your own use. Not that you can have code running on Enter press, it also will not bring up action menu (actually same custom code could be done with mouse scroll).

inGameUISetEventHandler [ "Action", "hint 'Lights, Camera...Action!'; true" ];

Well, I have to say, this was probably as unexpected for me as it was unexpected for you. Oh and if you knew about this all along, you better keep quiet about it, because there is no reason not to add this to BIKI, other than own selfishness. And this is exactly what I am going to do, edit BIKI after I finished this.

Enjoy,
KK