LookUpControl issues.

Wardly

Chieftain
Joined
Nov 9, 2014
Messages
39
I don't know why i can't get this to work. I'm obviously don't understand it's usage. Can i get some insight on what i'm doing wrong here? From reading some tutorials it seems like this should work.

What i'm wanting to do is basically just execute the block of code based on when the production popup is opened/closed.

Code:
            local ProductionPopup = ContextPtr:LookUpControl("/InGame/Popups/ProductionPopup");
            if( ProductionPopup ~= nil ) then
                print("PRODUCTION WINDOW IS OPEN")
            else
                print("PRODUCTION WINDOW IS -NOT- OPEN")
            end
 
Which production popup? There are two that I'm aware of.

Also, where is this code embedded? When does it run?
 
While the file may indeed be .../InGame/Popups/ProductionPopup.xml/lua the control is InGame/ProductionPopup

Look in InGame.xml

Code:
<LuaContext FileName="Assets/UI/InGame/Popups/ProductionPopup" ID="ProductionPopup" Hidden="True"/>

The ID is just ProductionPopup, so relative to InGame it is InGame/ProductionPopup

Also (once the game session has started - ie post load/start), the control will always exist (which is what for check against nil is testing for), if you want to know if the popup is visible (not hidden) you'll need to use "not ProductionPopup:IsHidden()"
 
Back
Top Bottom