Python Performance and Interface Overhaul (PPIO)

Yeah its always so damn hard to find unit you're looking for, especially workers and colonists. They always jump around too as new units are added. Plus, the sort/group options don't persist between cities.
 
@Thunderbrd :

I really need a reliable way for python to know if ctrl/alt/shift keys are pressed, like how the dll does it.
gDLL->shiftKey()
gDLL->altKey()
gDLL->ctrlKey()

One new "python to dll" function that returns all of them in a list would be nice. Three new functions that simply returns one of them would work too.
Sounds like typical global context functions to me, but you would know better if it should be somewhere else instead.

There already exist a "CyInterface::shiftKey()" function, but that always return false when called.

Python is completely shut out from any knowledge about when those buttons are pressed when a city is selected.
When no city is selected python can catch the key state through the python event "onKbdEvent". but that python event is disabled when a city is selected. :sad:

I understand you're on a break, but it don't hurt to ask. ^^
Perhaps @makotech222, would like to learn about python to dll communication. The functions I'm asking for would be simple enough for him to manage by replicating from examples other places in the dll.
 
Last edited:
@Thunderbrd :

I really need a reliable way for python to know if ctrl/alt/shift keys are pressed, like how the dll does it.
gDLL->shiftKey()
gDLL->altKey()
gDLL->ctrlKey()

One new "python to dll" function that returns all of them in a list would be nice. Three new functions that simply returns one of them would work too.
Sounds like typical CyInterface functions to me, but you would know better if it should be "global context", or "CyGame", or "CyEngine" functions instead.

There already exist a "CyInterface::shiftKey()" function, but that always return false when called.

Python is completely shut out from any knowledge about when those buttons are pressed when a city is selected.
When no city is selected python can catch the key state through the python event "onKbdEvent". but that python event is disabled when a city is selected. :sad:
I really don't know enough about this to act on it.
 
I can get it working if I add a function to the GC. Seems a bit messy to put it there, though. Where is this CyInterface:shiftKey function defined in dll? I couldn't find it :p. Closest I found was in CyInfoInterface for CvInterfaceModeInfo there is isShiftDown
 
I've done python -> dll, but not the reverse. I can maybe take a look.
What little I know:

-All the source files that starts with "Cy" are related to python interaction.
-dll functions that can be called from python are listed in files that end with "interface", e.g. CyGlobalContextInterface1.cpp
-Those files that ends with "interface" can be considered as simple indexes that glue py and dll together. They simply redirect the python call to the appropriate "Cy" file which again communicate with the "Cv" files.
-All the pyrthon functions listed in CyGlobalContextInterface1 would probably redirect to a function located in the CyGlobalContext.cpp which would again have a direct line of communication with the CvGlobalContext.cpp.
I can get it working if I add a function to the GC. Seems a bit messy to put it there, though. Where is this CyInterface:shiftKey function defined in dll? I couldn't find it :p.
Sorry about that, CyInterface is not in the sdk, it is an object hidden away in the exe. When I work in python it is not always clear to me when I'm using exe or dll functions.. ^^

I think your options are Global Context and CvGame\CyGame
Closest I found was in CyInfoInterface for CvInterfaceModeInfo there is isShiftDown
Didn't know about that one.
Edit: I'll test those functions within CvInterfaceModeInfo right away.
EditEdit: Nope, they all returned False.
print CvInterfaceModeInfo().isAltDown()
print CvInterfaceModeInfo().isShiftDown()
print CvInterfaceModeInfo().isCtrlDown()
print CvInterfaceModeInfo().isAltDownAlt()
print CvInterfaceModeInfo().isShiftDownAlt()
print CvInterfaceModeInfo().isCtrlDownAlt()
I had them called 10 times a second while playing a bit with the buttons in-game.
Those Values are probably only updated when doing something quite specific in-game, like some unit action in the line of "go to" or something.
 
Last edited:
Okay, ill throw them in the GC then. Simple enough. I tested on python and it worked. Gimme like an hour or so.
 
So you don't know if the dll has the capability to find out the state of the ctrl/alt/shift keys at any given moment?
I'm sure it does but I'm not devoting time to modding at the moment.

Thanks Mako! You're really stepping up lately and it's appreciated!
 
Ah okay. Yeah getting c2c to compile was a *****.
I'm baffled, those new functions also always return False when a city is selected, seems the exe simply don't want to share the key state info when a city is selected...

I'll need to ponder this one for a bit, there must be some kind of workaround.
 
Yeah i put my prints in the handleInputs method of MainScreen. I moused over the imagebuttons to see if its prints correctly, and it did.
 
Top Bottom