Retrieving the current state of the interface in Python?

lutorm

Chieftain
Joined
Apr 27, 2006
Messages
2
Hi all,

I want to try to integrate CivIV with the voice recognition engine Dragon NaturallySpeaking. DNS has a python interface module and runs its own python interpreter. I want to connect this with the python interpreter in CivIV so that the voice recognition engine can query civ for the current state of the interface and activate an appropriate voice command grammar.

The first question is: how do I find out which screen is currently being shown (normal, city, advisors, globe, etc)? It seems the CyGInterfaceScreen has a lot of add... and set... methods, but I haven't seen a way to retrieve the current screen instance or how to identify the possible actions in the current screen.

Second question: can I perform player actions through python calls?

Any pointers would be most helpful! Thanks,

/Patrik
 
Maybe responding to my own post will give other people inspiration, too... ;)

The methods CyInterface::isScreenUp and isCityScreenUp can be used to query which screen is being shown, or if the city screen (which doesn't seem to be a screen as such) is displayed. Also, CvScreensInterface::toggleSetScreenOn and toggleSetNoScreens are called when a screen is brought up and when it's not. This works for the main screens such as the advisors, pedia, etc, but not for city screen. What seems harder is to get info about the popups. They seem to be dynamically created for each instance, and don't have an identifier. From the example in CyPopupInterface, it seems CyPopup::launch would be the place to report that a popup has been displayed, but I can't find python source for this, so it's probably in a dll somewhere... :-( I hope I don't have to go through and find all instances of a CyPopup being made!

any comments or hints?

/Patrik
 
Back
Top Bottom