OnEventReceived(popupInfo)

Nutty

Deity
Joined
Mar 9, 2011
Messages
3,181
Location
Orange County, California, U.S.A.
I'd like to use ContextPtr:LookUpControl() rather than replace game files in the next version of City States Leaders, however it appears that OnEventReceived(popupInfo) doesn't trigger when the popup is refreshed when, e.g., the city state responds to a pledge to protect.



How do I detect when the popup is refreshed?

EDIT #2: Could it be that it's just a different popup button type?

EDIT: Also, how do I enter a newline in a label? "\n" and "\r\n" don't work...

Thanks!
 
EDIT: Also, how do I enter a newline in a label? "\n" and "\r\n" don't work...

The easy one to answer ... [NEWLINE]
 
How do I detect when the popup is refreshed?

Clicking the pledge button starts a sequence of events within the DLL that ultimately ends up with the DLL setting the "GameDirty" flag, which is then trapped by the OnGameDataDirty() event handler in the same Lua code that responded to the original pledge button click. OnGameDataDirty() just calls OnDisplay() provided that the pop-up is visible, which is the same code that originally filled the pop-up dialog.
 
Hmm, thanks! Is there any reason changing to OnDisplay(popupInfo) would be problematic?

OnDisplay() is called from two locations, popupInfo is only in scope for one of them, so the second call will be OnDisplay(nil), which probably will cause issues.

You can use OnDisplay(m_PopupInfo), as m_PopupInfo is a global so in scope at both calls (and initialised correctly), but if you're going to do that, why not just use the global m_PopupInfo directly from within the OnDisplay() function?
 
I don't understand what you mean by "directly." Are you talking about setting a member of m_PopupInfo or something instead of using ContextPtr:LookUpControl()?
 
OnDisplay() (in CityStateDiploPopup.lua) doesn't take a parameter, so either your call of OnDisplay(popupInfo) will do nothing with the popupInfo parameter, or you've modified the CityStateDiploPopup.lua code such that OnDisplay() does take a parameter, in which case you need to make sure that you're passing a parameter everywhere OnDisplay() is called, ie in the OnGameDataDirty() method
 
Top Bottom