Jump to content

Recommended Posts

When I open container, I am adding items to container.
_object addEventHandler 
[
	"ContainerOpened",
	{ 
		params ["_container", "_player"];

		{ _container addItemCargoGlobal [_x, 1]; } forEach ["FirstAidKit", "MineDetector", "ItemMap"];
	}
];
Problem: I don't see items in inventory.  I need to do some action (selection in dialog) to see those items inserted items.
 
Question: How to "AUTO-REFRESH" dialog so I can see items in inventory list?
 
Possible solutions:
- refresh dialog
- waitUntil { code }; showDialog;
- other
 
 
GUI Wizard @moricky do you have some ideas ?

Share this post


Link to post
Share on other sites

Weve had this question crop up before on the forum. There seems to be some process by the engine in which it caches the containers contents just before it opens the inventory display and which is not updated again until the display has initialised fully. Adding anything during this time causes it not to display until you do something, like changing the container filter. You can get around it by waiting until the inventory display has initialised.

_object addEventHandler [ "ContainerOpened", {
	_nul = _this spawn {
		params ["_container", "_player"]; 
		waitUntil{ !isNull findDisplay 602 };
		{ _container addItemCargoGlobal [_x, 1]; } forEach ["FirstAidKit", "MineDetector", "ItemMap"]; 
	};
}];

If you are adding lots of stuff the end user may see the last few things appear.

Share this post


Link to post
Share on other sites
12 minutes ago, Larrow said:

Weve had this question crop up before on the forum. There seems to be some process by the engine in which it caches the containers contents just before it opens the inventory display and which is not updated again until the display has initialised fully. Adding anything during this time causes it not to display until you do something, like changing the container filter. You can get around it by waiting until the inventory display has initialised.


_object addEventHandler [ "ContainerOpened", {
	_nul = _this spawn {
		params ["_container", "_player"]; 
		waitUntil{ !isNull findDisplay 602 };
		{ _container addItemCargoGlobal [_x, 1]; } forEach ["FirstAidKit", "MineDetector", "ItemMap"]; 
	};
}];

If you are adding lots of stuff the end user may see the last few things appear.

 

I did search forum for this, but nothing pop-up. I was considering this approach, but I do not know, which "display idc" to add to waitUntill. I do not know which idc is for which display.

 

Thank you. Second solution ( waitUntil { code }; ) is working, will try also with "a lot of items" to see results.

 

 

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

×