I have run into a situation where I don't quite understand how the cando Python calls work on events. This is for RoM: AND but it should work for other mods.
I am trying to create an event with a Python trigger. I have done this before but now I am getting the error message NameError: global name 'argsList' is not defined even with a very simple test routine. I added the routine to CvRandomEventInterface.py so there should not be any issues of undefined functions.
I set up the event in an XML-only version and the event works fine. It triggers as expected and the required triggers are a state religion and a unit class. So I added the Python trigger to the event:
and then I set up this as a test routine:
This pops up the error message even though I haven't tried to make anything happen. Do I have to use a <PythonCanDoUnit>? I am not trying to query any information about the unit. All that matters on the unit side is that the player owns 1 of the appropriate unit. Or am I missing something else?
I am trying to create an event with a Python trigger. I have done this before but now I am getting the error message NameError: global name 'argsList' is not defined even with a very simple test routine. I added the routine to CvRandomEventInterface.py so there should not be any issues of undefined functions.
I set up the event in an XML-only version and the event works fine. It triggers as expected and the required triggers are a state religion and a unit class. So I added the Python trigger to the event:
Code:
<PythonCanDo>canTriggerTest</PythonCanDo>
and then I set up this as a test routine:
Code:
def canTriggerTest(argslist):
kTriggeredData = argsList[0]
return True
This pops up the error message even though I haven't tried to make anything happen. Do I have to use a <PythonCanDoUnit>? I am not trying to query any information about the unit. All that matters on the unit side is that the player owns 1 of the appropriate unit. Or am I missing something else?