Python problem with 'self' as a parameter

RogerBacon

King
Joined
Nov 16, 2003
Messages
649
I'm trying to make a popup that the user can make a selection from and then the game will act on his selection. Unfortunately, before I can even get around to doing the coding for that, I can't seem to make even the simple popup work right.
I am copying the popup in the terraform code that has the user select a water square qand then turns that square into land. I pass the same arguments but I get the error:
File "CvEventInterface", line 23, in onEvent
File "CvCustomEventManager", line 65, in handleEvent
File "CvEventManager", line 177, in handleEvent
File "CvCustomEventManager", line 348, in onMouseEvent
File "SpellDemo", line 60, in onMouseEvent
File "Spelldemo", line 147, in cast
File "SpellInfo", line 115, in inner
File "CvCustomEventManager", line 72, in beginEvent
File "CvEventManager", line 184, in beginEvent
File "CvCustomEventManager", line 361, in __eventSummonBegin
TypeError: eventSummonBegin() takes exactly 2 arguments (1 given)

I think it doesn't like the 'self' argument. I've always had problems with that one. The terraform example works fine and it has the same signature as my function. Does anyone know why that would work and mine doesn't? I've attached the code if anyone wants to take a look.

Roger Bacon
 

Attachments

eventSummonBegin is not in a class. Remove self or put it in a class (and change the call).
 
Thanks Snarko. I did what you suggested and now I can get the popup to appear. Of course after I hit "OK" the game crashes so I've still got lots of problems obviously. It sure looks the same as the terraforming code but that works fine.
Well, that's enough for tonight. I'll look at it again tomorrow.

Roger Bacon
 
Roger, check out my Great Statesman mod, I have code in there that brings up a popup, allows a user to select a leader they have met and perform the action depending on the current relations level between the two leaders.
 
Back
Top Bottom