Jump to content
Sign in to follow this  
wok

How to find if/when inventory open/closes?

Recommended Posts

Since I can't add custom items to the inventory (without addons), not even objects like the antibiotics, blood bag and all those Objects (small) recently added, I am thinking about doing some dialogs to fake a few inventory slots for some of these items. I have the dialogs done, but I don't know how to trigger the open/close dialog when the inventory opens and close. I couldn't find a event handler for this.

Does anyone knows a workaround?

Edited by wok

Share this post


Link to post
Share on other sites
waitUntil {!isnull (findDisplay 602)};
hint "inventory open";
createDialog "someDialog";

Share this post


Link to post
Share on other sites

Thanks a lot, the problem I am having now is that, if I use createDialog to open the dialog, then the inventory wont open until I close the dialog (with esc), and I need both the inventory and my dialog to open at the same time since I am not handling the entire inventory, just a few fake slots.

The inventory opens fine if I use RscTitles and cutRsc instead, but that gives me a different problem. I want to open some sort of contextual menu when clicking on the fake slot, and display some options on a listbox. When using createDialog, the mouse event handlers (im trying to use onMouseButtonClick) work well, but when using cutRsc the click event doesnt fire anything. Will see if I can create a sample later, my current code is too messy right now.

Share this post


Link to post
Share on other sites

I was crossing my fingers for you lol. Sounds like quite a fiasco you've stumbled into :p. Maybe someone with better knowledge of dialogs can chip in here. I'd like to see how you can do this.

Share this post


Link to post
Share on other sites

Maybe check how ACE did it for Arma 2

It may take a full replacement of the inventory system to allow it to work

Of course that would potentially be a mod and not script

Share this post


Link to post
Share on other sites

Have tried a few different things like using createDialog in the rsctitles onLoad to open a separated dialog, but that also stops the inventory from opening until you close the dialog. Also tried using execVM instead of using createDialog directly on the rsctitles onload, so I could use sleep and make sure the inventory was already open, but then the inventory closes when the dialog opens. I will keep trying for a few days but I guess I will end up using addAction for the items options. Thanks a lot for the help anyway iceman.

KevsnoTrev, thanks for the suggestion but I am trying to use scripts only, no addons. With addons it shouldn't be too hard, I think dayz does something like that too.

A "solution" I was thinking about is adding a mouse click event handler to the main display like:

(findDisplay 46) displayAddEventHandler["onMouseButtonClick", "hint str _this;"];

And then calculate if the coordinates where the click happened are the same position than the fake slots, that does fires when clicking even with the inventory open, but the coordinates always return 0.5, 0.5. And I think it would be a pain in the ass to make it work across all resolutions/aspect ratios anyway.

Edited by wok

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  

×