[Questions] Events

Phobia.

Chieftain
Joined
Jan 27, 2006
Messages
6
Hi all.

This is my first shot at writting Python code and Python CIV mod, so please bear with me. :blush:

I have 2 questions regarding Events and would appreciate any help:

1. Reading through one of the modding tutorials, I thought that by placing my customized "CvMyEventManager.py" in the main \Assets\Python folder (not into the mod folder) would override the defualt handler. I guess I am missing something since my handlers are ignored. Anyone has an idea what am I missing? Has it anything to do with the EntryPoints folder I see in other mods?

2. I am trying to hook the event when the user single-left-clicks the name bar of a city. I followed the code in CvEventManager.py to the onMouseEvent/EventLButtonDown event. But there I'm afraid I got lost. What
happens next? Which class/method is used when the city's name bar (which shows the growth and production progress) is clicked?

Thanks.
 
Phobia. said:
2. I am trying to hook the event when the user single-left-clicks the name bar of a city. I followed the code in CvEventManager.py to the onMouseEvent/EventLButtonDown event. But there I'm afraid I got lost. What
happens next? Which class/method is used when the city's name bar (which shows the growth and production progress) is clicked?

Thanks.
I suggest checking out how CvMainInterface.py under updateSelectionButtons and updateCityScreen, and using the criteria there for working out if the city selection buttons are up, but the city screen is not. If this is true, then the city must have been selected using the city name (or the domestic advisor... but you can probably check for that as well by seeing if that screen is active).

You'll probably have to return 0 from the mouse event, otherwise it will be consumed and the city selection buttons might not show up as normal (you may have to test this).

EDIT: Didn't quite get the question with 1) the first time around...
Phobia. said:
1. Reading through one of the modding tutorials, I thought that by placing my customized "CvMyEventManager.py" in the main \Assets\Python folder (not into the mod folder) would override the defualt handler. I guess I am missing something since my handlers are ignored. Anyone has an idea what am I missing? Has it anything to do with the EntryPoints folder I see in other mods?
NEVER overwrite the game files. If you want to overwrite the default game place your file in My Documents/My Games/S'M'Civ' 4/Assets/...

As for EntryPoints - there is a file in here which defines the name of your event manager, if you change this name, you change which event manager to use. There are several different ways of managing events out there which make mods alot more easy to combine, although I haven't really tested many myself.
 
TGA, thanks for your tutorials and thanks for your help here.

The Great Apple said:
NEVER overwrite the game files. If you want to overwrite the default game place your file in My Documents/My Games/S'M'Civ' 4/Assets/...

As for EntryPoints - there is a file in here which defines the name of your event manager, if you change this name, you change which event manager to use. There are several different ways of managing events out there which make mods alot more easy to combine, although I haven't really tested many myself.
I did not want to code directly into CvEventManager.py, but since I didn't figure out how to override the EventManager, I made a copy of it and started coding in the original.
So are you saying that the files in the EntryPoints are the key to solving my overriding issue?
 
Back
Top Bottom