Possible to Simulate a Key Press?

JFD

Kathigitarkh
Joined
Oct 19, 2010
Messages
9,132
Location
The Kingdom of New Zealand
I'm hoping to simulate the pressing of the ESC key when the 'Choose International Trade Route' pops up, as I have my own which I call first, but this otherwise results in two screens poping up at once. Because the Context is unretrievable via ContextPtr:LookUpControl (being mostly an instance, I guess), there are only two options that I can think of: simulate the ESC key or invoke Events.UnitSelectionChanged(). The latter works, but it does complain about being used in this way. Any help would be great, or even any other suggestions about killing this screen, without replacing it outright.
 
Code:
UIManager:DequeuePopup(ContextPtr:LookUpControl("/InGame/ChooseInternationalTradeRoute"))

works for me
 
I'd been using the full name of the file

You need to use the ID given in the <LuaContext> element (in InGame.xml in this case) that includes the file containing the sub-context, not the actual file name (admittedly Firaxis tend to make these one and the same, but every now and again they throw a curve-ball at ya!)
 
Back
Top Bottom