Louis the XIV
Sun King
Hi! I have been trying to make civ open a file and write the turn in it on the endTurn function in the CvEventManager.py file.
My endTurn function looks like this but it is not writing anything in the file when I click end turn in game, nor any errors.
I tried to make it write just a string like "hello" but even that didn't work. I also tried to open the file like this
but that also didn't work.
Any help or advice appreciated!
EDIT:
It created/edited the files in the Beyond the Sword folder and not the folder of the CvEventManager.py!
My endTurn function looks like this but it is not writing anything in the file when I click end turn in game, nor any errors.
Code:
def onEndGameTurn(self, argsList):
'Called at the end of the end of each turn'
current_turn = gc.getGame().getGameTurn()
file = open("turn.txt", "w")
file.write(str(current_turn))
file.close()
iGameTurn = argsList[0]
Code:
with open("turn.txt", "w") as file:
file.write("something")
file.close()
Any help or advice appreciated!
EDIT:
It created/edited the files in the Beyond the Sword folder and not the folder of the CvEventManager.py!
Last edited: