Wintermod coding help

It's another syntax error on the same line as last time. So it's something in the following line (and the line after caz its almost exactly the same):

Code:
for x in range(map.getGridWidth()):

Sorry, wasn't thinking when I used the spoiler tags, guess I was just trying to save room... perhaps I should have done spoiler and code at the same time :p
 
Can I get a hint? Please? A "syntax error" is a little too vague for me to figure out. Can you post the contents of Logs/PythonErr.log?
 
'..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed\\src-images', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM']

sys.modules = {'copy_reg': <module 'copy_reg' from 'C:\Python24\Lib\copy_reg.pyc'>, 'locale': <module 'locale' from 'C:\Python24\Lib\locale.pyc'>, '__main__': <module '__main__' (built-in)>, 'site': <module 'site' from 'C:\Python24\Lib\site.pyc'>, '__builtin__': <module '__builtin__' (built-in)>, 'encodings': <module 'encodings' from 'C:\Python24\Lib\encodings\__init__.pyc'>, 'os.path': <module 'ntpath' from 'C:\Python24\Lib\ntpath.pyc'>, 'encodings.codecs': None, 'ntpath': <module 'ntpath' from 'C:\Python24\Lib\ntpath.pyc'>, 'UserDict': <module 'UserDict' from 'C:\Python24\Lib\UserDict.pyc'>, 'encodings.exceptions': None, 'nt': <module 'nt' (built-in)>, 'stat': <module 'stat' from 'C:\Python24\Lib\stat.pyc'>, 'zipimport': <module 'zipimport' (built-in)>, 'warnings': <module 'warnings' from 'C:\Python24\Lib\warnings.pyc'>, 'encodings.types': None, '_codecs': <module '_codecs' (built-in)>, 'encodings.cp1252': <module 'encodings.cp1252' from 'C:\Python24\Lib\encodings\cp1252.pyc'>, 'sys': <module 'sys' (built-in)>, 'codecs': <module 'codecs' from 'C:\Python24\Lib\codecs.pyc'>, 'types': <module 'types' from 'C:\Python24\Lib\types.pyc'>, '_locale': <module '_locale' (built-in)>, 'signal': <module 'signal' (built-in)>, 'linecache': <module 'linecache' from 'C:\Python24\Lib\linecache.pyc'>, 'encodings.aliases': <module 'encodings.aliases' from 'C:\Python24\Lib\encodings\aliases.pyc'>, 'exceptions': <module 'exceptions' (built-in)>, 'CvPythonExtensions': <module 'CvPythonExtensions' (built-in)>, 'os': <module 'os' from 'C:\Python24\Lib\os.pyc'>}

sys.builtin_module_names = ('CvPythonExtensions', '__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec', '_random', '_sre', '_subprocess', '_symtable', '_weakref', '_winreg', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt', 'operator', 'parser', 'regex', 'rgbimg', 'sha', 'signal', 'strop', 'struct', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
load_module CvEventInterface
load_module BugEventManager
load_module CvEventManager
Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 13, in ?
File "<string>", line 52, in load_module
File "BugEventManager", line 58, in ?
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
File "CvEventManager", line 363
for x in range(map.getGridWidth()):
^
SyntaxError: invalid syntax
load_module CvAppInterface
load_module CvUtil
load_module traceback
load_module xmllib





I'm sorry it took so long, I haven't been able to run Civ4 until very recently.

Kevin
 
My guess is that your indentation isn't correct. Make sure you're using a good editor that will use tabs instead of spaces for indentation. Turn on view whitespace mode and back sure it matches the line before it.
 
I fixed all indentation, and then there was some conflict with some RFC files, which I fixed, among other things.

It still has no effect, and this is what the log looks like now, even though it doesn't really seem like there was an error...

Code:
sys.path = ['..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\email', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\encodings', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\build', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\colourchooser', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\editor', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\floatcanvas', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\masked', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\mixins', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\ogl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py\\tests', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed\\src-images', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM']

sys.modules = {'copy_reg': <module 'copy_reg' from 'C:\Python24\Lib\copy_reg.pyc'>, 'locale': <module 'locale' from 'C:\Python24\Lib\locale.pyc'>, '__main__': <module '__main__' (built-in)>, 'site': <module 'site' from 'C:\Python24\Lib\site.pyc'>, '__builtin__': <module '__builtin__' (built-in)>, 'encodings': <module 'encodings' from 'C:\Python24\Lib\encodings\__init__.pyc'>, 'os.path': <module 'ntpath' from 'C:\Python24\Lib\ntpath.pyc'>, 'encodings.codecs': None, 'ntpath': <module 'ntpath' from 'C:\Python24\Lib\ntpath.pyc'>, 'UserDict': <module 'UserDict' from 'C:\Python24\Lib\UserDict.pyc'>, 'encodings.exceptions': None, 'nt': <module 'nt' (built-in)>, 'stat': <module 'stat' from 'C:\Python24\Lib\stat.pyc'>, 'zipimport': <module 'zipimport' (built-in)>, 'warnings': <module 'warnings' from 'C:\Python24\Lib\warnings.pyc'>, 'encodings.types': None, '_codecs': <module '_codecs' (built-in)>, 'encodings.cp1252': <module 'encodings.cp1252' from 'C:\Python24\Lib\encodings\cp1252.pyc'>, 'sys': <module 'sys' (built-in)>, 'codecs': <module 'codecs' from 'C:\Python24\Lib\codecs.pyc'>, 'types': <module 'types' from 'C:\Python24\Lib\types.pyc'>, '_locale': <module '_locale' (built-in)>, 'signal': <module 'signal' (built-in)>, 'linecache': <module 'linecache' from 'C:\Python24\Lib\linecache.pyc'>, 'encodings.aliases': <module 'encodings.aliases' from 'C:\Python24\Lib\encodings\aliases.pyc'>, 'exceptions': <module 'exceptions' (built-in)>, 'CvPythonExtensions': <module 'CvPythonExtensions' (built-in)>, 'os': <module 'os' from 'C:\Python24\Lib\os.pyc'>}

sys.builtin_module_names = ('CvPythonExtensions', '__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec', '_random', '_sre', '_subprocess', '_symtable', '_weakref', '_winreg', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt', 'operator', 'parser', 'regex', 'rgbimg', 'sha', 'signal', 'strop', 'struct', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
load_module CvEventInterface
load_module BugEventManager
load_module CvEventManager
load_module CvUtil
load_module traceback
load_module CvScreensInterface
load_module CvMainInterface
load_module ScreenInput
load_module CvScreenEnums
load_module time
load_module BugCore
load_module BugUtil
load_module ColorUtil
14:24:01 INFO : BugCore - creating uninitialized mod NJAGC
14:24:01 INFO : BugCore - creating uninitialized mod Scores
14:24:01 INFO : BugCore - creating uninitialized mod MainInterface
14:24:01 INFO : BugCore - creating uninitialized mod CityScreen
load_module MonkeyTools
load_module PyHelpers
load_module string
load_module AStarTools
14:24:02 INFO : BugCore - creating uninitialized mod PLE
load_module Scoreboard
load_module DealUtil
load_module PlayerUtil
load_module ReminderEventManager
load_module Popup
load_module InputUtil
load_module SdToolKit
load_module cPickle
load_module autolog
load_module BugOptions
load_module BugConfigTracker
load_module BugPath
load_module CvModName
load_module _winreg
load_module configobj
load_module __future__
load_module validate
validate import failed
14:24:03 INFO : BugCore - creating uninitialized mod Autolog
14:24:03 INFO : BugCore - creating uninitialized mod Reminder
load_module GGUtil
load_module GPUtil
load_module RawYields
load_module CvTechChooser
load_module TechPrefs
14:24:03 INFO : BugCore - creating uninitialized mod Advisors
load_module CvForeignAdvisor
load_module math
load_module CvExoticForeignAdvisor
load_module IconGrid_BUG
load_module DomPyHelpers
load_module TechTree
load_module AttitudeUtils
load_module FavoriteCivicDetector
load_module CvFinanceAdvisor
load_module CvReligionScreen
load_module CvCorporationScreen
load_module CvCivicsScreen
load_module CvVictoryScreen
load_module TechUtil
load_module CvEspionageAdvisor
14:24:03 INFO : BugCore - creating uninitialized mod BetterEspionage
load_module CvOptionsScreen
load_module CvReplayScreen
load_module CvHallOfFameScreen
load_module CvDanQuayle
load_module CvGameUtils
load_module CvUnVictoryScreen
load_module CvDawnOfMan
load_module CvTechSplashScreen
load_module CvTopCivs
load_module random
load_module CvInfoScreen
load_module CvIntroMovieScreen
load_module CvVictoryMovieScreen
load_module CvWonderMovieScreen
load_module CvEraMovieScreen
load_module CvSpaceShipScreen
load_module SevoScreenEnums
load_module CvWorldBuilderScreen
load_module CvWorldBuilderDiplomacyScreen
load_module CvDebugTools
load_module CvDebugInfoScreen
load_module CvMapGeneratorUtil
load_module CvGFCScreen
load_module CvPopupInterface
load_module CvScreenUtilsInterface
load_module CvScreenUtils
load_module BugOptionsScreen
load_module BugErrorOptionsTab
load_module BugOptionsTab
14:24:06 INFO : BugCore - creating uninitialized mod TechWindow
init-ing world builder screen
load_module CvWBPopups
load_module CvCameraControls
load_module CvAdvisorUtils
14:24:06 DEBUG: BugEventManager - adding event 'PreGameStart'
14:24:06 DEBUG: BugEventManager - adding event 'BeginActivePlayerTurn'
14:24:06 DEBUG: BugEventManager - adding event 'LanguageChanged'
PY:OnInit
load_module CvAppInterface
load_module xmllib


EDIT: also, your code either didn't have an error or yielded the same thing. However, neither code is working
 
That looks like the PythonDbg.log file--not PythonErr.log. It also looks like you're running BUG (I haven't read back up this thread to see the background).
 
I know, it's strange, it doesn't look like there's an error, but it is PythonErr2.log, which pops up while I play the game.

And you're right, I merged the stuff with BUG, because for some reason the interface for my mod wasnt working but BUG was. I just made a new mod folder for it, so I could test it on its own, and I get:

sys.path = ['..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\email', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\encodings', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\build', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\colourchooser', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\editor', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\floatcanvas', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\masked', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\mixins', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\ogl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py\\tests', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed\\src-images', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM']

sys.modules = {'copy_reg': <module 'copy_reg' from 'C:\Python24\Lib\copy_reg.pyc'>, 'locale': <module 'locale' from 'C:\Python24\Lib\locale.pyc'>, '__main__': <module '__main__' (built-in)>, 'site': <module 'site' from 'C:\Python24\Lib\site.pyc'>, '__builtin__': <module '__builtin__' (built-in)>, 'encodings': <module 'encodings' from 'C:\Python24\Lib\encodings\__init__.pyc'>, 'os.path': <module 'ntpath' from 'C:\Python24\Lib\ntpath.pyc'>, 'encodings.codecs': None, 'ntpath': <module 'ntpath' from 'C:\Python24\Lib\ntpath.pyc'>, 'UserDict': <module 'UserDict' from 'C:\Python24\Lib\UserDict.pyc'>, 'encodings.exceptions': None, 'nt': <module 'nt' (built-in)>, 'stat': <module 'stat' from 'C:\Python24\Lib\stat.pyc'>, 'zipimport': <module 'zipimport' (built-in)>, 'warnings': <module 'warnings' from 'C:\Python24\Lib\warnings.pyc'>, 'encodings.types': None, '_codecs': <module '_codecs' (built-in)>, 'encodings.cp1252': <module 'encodings.cp1252' from 'C:\Python24\Lib\encodings\cp1252.pyc'>, 'sys': <module 'sys' (built-in)>, 'codecs': <module 'codecs' from 'C:\Python24\Lib\codecs.pyc'>, 'types': <module 'types' from 'C:\Python24\Lib\types.pyc'>, '_locale': <module '_locale' (built-in)>, 'signal': <module 'signal' (built-in)>, 'linecache': <module 'linecache' from 'C:\Python24\Lib\linecache.pyc'>, 'encodings.aliases': <module 'encodings.aliases' from 'C:\Python24\Lib\encodings\aliases.pyc'>, 'exceptions': <module 'exceptions' (built-in)>, 'CvPythonExtensions': <module 'CvPythonExtensions' (built-in)>, 'os': <module 'os' from 'C:\Python24\Lib\os.pyc'>}

sys.builtin_module_names = ('CvPythonExtensions', '__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec', '_random', '_sre', '_subprocess', '_symtable', '_weakref', '_winreg', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt', 'operator', 'parser', 'regex', 'rgbimg', 'sha', 'signal', 'strop', 'struct', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
load_module CvEventInterface
load_module WinterEventManager
load_module CvEventManager
load_module CvUtil
load_module traceback
load_module CvScreensInterface
load_module CvMainInterface
load_module ScreenInput
load_module CvScreenEnums
load_module time
load_module CvDomesticAdvisor
load_module CvTechChooser
load_module CvForeignAdvisor
load_module math
load_module CvExoticForeignAdvisor
load_module IconGrid
load_module DomPyHelpers
load_module PyHelpers
load_module TechTree
load_module re
load_module CvMilitaryAdvisor
load_module CvFinanceAdvisor
load_module CvReligionScreen
load_module CvCorporationScreen
load_module CvCivicsScreen
load_module string
load_module CvVictoryScreen
load_module CvEspionageAdvisor
load_module CvOptionsScreen
load_module CvReplayScreen
load_module CvHallOfFameScreen
load_module CvDanQuayle
load_module CvGameUtils
load_module CvUnVictoryScreen
load_module CvDawnOfMan
load_module CvTechSplashScreen
load_module CvTopCivs
load_module random
load_module CvInfoScreen
load_module CvIntroMovieScreen
load_module CvVictoryMovieScreen
load_module CvWonderMovieScreen
load_module CvEraMovieScreen
load_module CvSpaceShipScreen
load_module CvPediaMain
load_module CvPediaScreen
load_module CvScreen
load_module CvPediaTech
load_module CvPediaUnit
load_module CvPediaBuilding
load_module CvPediaPromotion
load_module CvPediaUnitChart
load_module CvPediaBonus
load_module CvPediaTerrain
load_module CvPediaFeature
load_module CvPediaImprovement
load_module CvPediaCivic
load_module CvPediaCivilization
load_module CvPediaLeader
load_module CvPediaSpecialist
load_module CvPediaHistory
load_module CvPediaProject
load_module CvPediaReligion
load_module CvPediaCorporation
load_module CvWorldBuilderScreen
load_module Popup
load_module CvWorldBuilderDiplomacyScreen
load_module CvDebugTools
load_module CvDebugInfoScreen
load_module CvMapGeneratorUtil
load_module CvGFCScreen
load_module CvPopupInterface
load_module CvScreenUtilsInterface
load_module CvScreenUtils
init-ing world builder screen
load_module CvWBPopups
load_module CvCameraControls
load_module CvAdvisorUtils
PY:OnInit
load_module CvAppInterface

Again, it seems like there is no error.

MY CODE: appears to have no effect.

YOUR CODE: says the gameturn#, says winterfreeze/springthaw, but there is no visual change (and it says grass: 0 and plains: 0) and my 10x10 map is all ocean, coast, grass, and one or two tiles of plains. I have a feeling it's technically working, but the changes are not showing up. And anyways why would it say grass: 0 and plains: 0?

Kevin
 
is there anything that would prevent graphics/terrain changes from showing up? I don't think theres any problem with either code

Kevin
 
Make sure you pass in True for the bRebuildGraphics parameter (3rd) of your call to

Code:
setTerrainType(TerrainType eNewValue, BOOL bRecalculate, BOOL bRebuildGraphics)

You should probably also pass in True for the bRecalculate parameter (2nd).
 
I fixed this in your code. Unless I am mistaken, this was already done in my code.

I retested your code, and it looks like it's not a graphic issue but either a problem changing the terrain or a problem picking the terrain (it still says grass: 0 plains: 0).

I am guessing the problem is the same in my code, unless it's something to do with the settler map.

thanks for sticking with this
Kevin
 
This has spanned many months now. Can you summarize where you're at with it and what is and isn't working? Post the latest code you are using.
 
Here's a summary: Your code (the test code from your old thread) is unchanged, except that I fixed what you told me to fix in the last post.

I don't think my code has changed since last time, but here it is for convenience:

WINTERMOD2.py
Spoiler :

Code:
from CvPythonExtensions import *
import sys
import Popup as PyPopup
from PyHelpers import PyPlayer
import pickle
import CvEventManager
from CvScreenEnums import *
from PyHelpers import *
import CvUtil
import CvTopCivs
import CvAdvisorUtils
import PyHelpers
import Consts as con

# globals
gc = CyGlobalContext()
localText = CyTranslator()

DefaultUnitAI = UnitAITypes.NO_UNITAI

iTundra = con.iTundra
iThinsoil = con.iThinsoil
iGrass = con.iGrass
iPlains = con.iPlains
iSnow = con.iSnow    
     
TURNS_PER_MONTH = 4
FIRST_YEAR = -4000

def getYear(iGameTurn):
    """Returns the calendar year from the 0-based game turn."""
    return iGameTurn / (12 * TURNS_PER_MONTH) + FIRST_YEAR

def getMonth(iGameTurn):
    """Returns the 1-based month # from the 0-based game turn."""
    return iGameTurn / TURNS_PER_MONTH + 1

def getWeek(iGameTurn):
    """Returns the 1-based week # from the 0-based game turn."""
    return iGameTurn % TURNS_PER_MONTH + 1

tSnowMap = (

tSnowMap = (
((	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"40",	"40",	"0",	"0",	"0",	"0",	"60",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	)),
)

def snowCover(pPlot):
	iTurn = gc.getGame().getGameTurn()
	iMonth = getMonth(iTurn)
	iWeek = getWeek(iTurn)
	snowCover = tSnowMap[159-pPlot.getY()][pPlot.getX()]
	if iWeek == 1
		if iMonth == 1:
			if (snowCover != "10"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "20"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "30"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 2:
			if (snowCover != "40"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "50"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "60"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 3:
			if (snowCover != "70"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "80"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "90"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "100"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 4:
			if (snowCover != "110"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "120"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "130"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snowCover != "140"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 6:
			if (snowCover != "110"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snowCover != "120"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snowCover != "130"):
				pPlot.setTerrainType(iGrass,True,True)
			elif (snowCover != "140"):
				pPlot.setTerrainType(iPlains,True,True)
		elif iMonth == 7:
			if (snowCover != "70"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snowCover != "80"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snowCover != "90"):
				pPlot.setTerrainType(iGrass,True,True)
			elif (snowCover != "100"):
				pPlot.setTerrainType(iPlains,True,True)
		elif iMonth == 8:
			if (snowCover != "40"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snowCover != "50"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snowCover != "60"):
				pPlot.setTerrainType(iGrass,True,True)
		elif iMonth == 9:
			if (snowCover != "10"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snowCover != "20"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snowCover != "30"):
				pPlot.setTerrainType(iGrass,True,True)


and in the event manager:

Spoiler :

Code:
		map = CyMap()
		for x in range(map.getGridWidth()):
			for y in range(map.getGridHeight()):
				plot = map.plot(x, y)
				WinterMod2.Snowcover(plot)


I am currently testing on a 10x10map, as I have a 10x10 grid above.

The good things about my code: no errors
The bad things about my code: it doesn't work. It may be the link between the eventmanager and the main code (windermod2.py) or the snowmap or problems changing the terrain

The good things about your test code: no errors, rebuildgraphics now set at true. It says what it's supposed to say in-game "spring thaw, winter freeze, turn #, etc".
The bad things about your test code: It says plains: 0 and grassland: 0 despite the fact there are lots of grasslands and plains. And nothing changes. I'm guessing this is a problem either changing the terrain or finding the terrain to change

Mainly I most need/want help with my code, but I included these notes on yours just in case it helps, and just so you know that neither appears to be working

Kevin
 
Variable and function names are case-sensitive in Python. This function call in the event manager

Code:
WinterMod2.[B]Snowcover[/B](plot)

must match this function definition in WINTERMOD2.py

Code:
def [B]snowCover[/B](pPlot):

And not only that, but the module name must match the filename. The above should look like this:

Code:
import [B]WINTERMOD2[/B]
...
[B]WINTERMOD2.snowCover[/B](plot)

Finally, while this won't produce an error, it could be confusing: you create a variable named "snowCover" inside the function with the same name.

Code:
[B]snowCover[/B] = tSnowMap[159-pPlot.getY()][pPlot.getX()]

I suggest that you change the name of this variable to "snow" throughout the function.

I suspect you are getting errors, but you're just not seeing them. Check again that LoggingEnabled is set to 1 in the CivilizationIV.ini file and look for the PythonErr.log file. If that doesn't work, turn on PythonExceptions so you see them in-game as popup messages. If you still don't see any errors, your code just isn't being run at all because there are errors (see above) that Python will complain about (ImportError for the module name and AttributeError for the function name).
 
must match this function definition in WINTERMOD2.py
Fixed.

And not only that, but the module name must match the filename
It already does, I just wrote in all caps so you could identify it. However, thanks for letting me know the stuff inside is case sensitive- I'll watch out for that from now on

I forgot I reinstalled the game and had to reenable logging; however, your code winter freeze/spring thaw code still doesn't appear to work while producing no visible error

I have since used the format your code used. I now have 3 files organized as follows:

Spoiler :
CvEventInterface.py
Code:
from CvPythonExtensions import *
import WinterModEventManager

eventManager = WinterModEventManager.WinterEventManager()

def getEventManager():
	return eventManager

def onEvent(argsList):
	'Called when a game event happens - return 1 if the event was consumed'
	return getEventManager().handleEvent(argsList)

def applyEvent(argsList):
	context, playerID, netUserData, popupReturn = argsList
	return getEventManager().applyEvent(argsList)

def beginEvent(context, argsList=-1):
	return getEventManager().beginEvent(context, argsList)

WinterModEventManager.py
Code:
from CvPythonExtensions import *
import CvEventManager

gc = CyGlobalContext()

class WinterEventManager(CvEventManager.CvEventManager):

	def __init__(self):
		CvEventManager.CvEventManager.__init__(self)
		
		self.TERRAIN_GRASS_DATA = "G"
		self.TERRAIN_PLAINS_DATA = "P"

		self.TERRAIN_GRASS = gc.getInfoTypeForString("TERRAIN_GRASS")
		self.TERRAIN_PLAINS = gc.getInfoTypeForString("TERRAIN_PLAINS")
		self.TERRAIN_SNOW = gc.getInfoTypeForString("TERRAIN_SNOW")
		self.TERRAIN_TUNDRA = gc.getInfoTypeForString("TERRAIN_TUNDRA")

	def onBeginGameTurn(self, argsList):
		CvEventManager.CvEventManager.onBeginGameTurn(self, argsList)
		iGameTurn = argsList[0]
		map = CyMap()
		for x in range(map.getGridWidth()):
			for y in range(map.getGridHeight()):
				plot = map.plot(x, y)
				WinterMod2.SnowCover(plot)
note: I realize I probably don't need the def init part, I just didn't bother deleting it

WinterMod2.py
Code:
from CvPythonExtensions import *
import sys
import Popup as PyPopup
from PyHelpers import PyPlayer
import pickle
import CvEventManager
from CvScreenEnums import *
from PyHelpers import *
import CvUtil
import CvAdvisorUtils
import PyHelpers
import Consts as con

# globals
gc = CyGlobalContext()
localText = CyTranslator()

DefaultUnitAI = UnitAITypes.NO_UNITAI

iTundra = con.iTundra
iThinsoil = con.iThinsoil
iGrass = con.iGrass
iPlains = con.iPlains
iSnow = con.iSnow    
     
TURNS_PER_MONTH = 4
FIRST_YEAR = -4000

def getYear(iGameTurn):
    """Returns the calendar year from the 0-based game turn."""
    return iGameTurn / (12 * TURNS_PER_MONTH) + FIRST_YEAR

def getMonth(iGameTurn):
    """Returns the 1-based month # from the 0-based game turn."""
    return iGameTurn / TURNS_PER_MONTH + 1

def getWeek(iGameTurn):
    """Returns the 1-based week # from the 0-based game turn."""
    return iGameTurn % TURNS_PER_MONTH + 1

tSnowMap = (

tSnowMap = (
((	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"40",	"40",	"0",	"0",	"0",	"0",	"60",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	)),
)

def SnowCover(pPlot):
	iTurn = gc.getGame().getGameTurn()
	iMonth = getMonth(iTurn)
	iWeek = getWeek(iTurn)
	snow = tSnowMap[159-pPlot.getY()][pPlot.getX()]
	if iWeek == 1
		if iMonth == 1:
			if (snow != "10"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "20"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "30"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 2:
			if (snow != "40"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "50"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "60"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 3:
			if (snow != "70"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "80"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "90"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "100"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 4:
			if (snow != "110"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "120"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "130"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow != "140"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 6:
			if (snow != "110"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow != "120"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow != "130"):
				pPlot.setTerrainType(iGrass,True,True)
			elif (snow != "140"):
				pPlot.setTerrainType(iPlains,True,True)
		elif iMonth == 7:
			if (snow != "70"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow != "80"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow != "90"):
				pPlot.setTerrainType(iGrass,True,True)
			elif (snow != "100"):
				pPlot.setTerrainType(iPlains,True,True)
		elif iMonth == 8:
			if (snow != "40"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow != "50"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow != "60"):
				pPlot.setTerrainType(iGrass,True,True)
		elif iMonth == 9:
			if (snow != "10"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow != "20"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow != "30"):
				pPlot.setTerrainType(iGrass,True,True)

I now get the following error:

Spoiler :
NameError: global name 'WinterMod2' is not defined
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 11, in onEvent

File "CvEventManager", line 187, in handleEvent

File "WinterModEventManager", line 30, in onBeginGameTurn


Also, do you know why your code is behaving as I described in the last post? It for sure is not producing visible errors.

Kevin
 
Don't believe I didn't notice that. Fixed that, and another simple mistake I found through the log, and now I just realized that all along I had copied != from a different mod, thinking that it meant equal to, when it doesnt :p So that is fixed too

Here is the code, just in case

Spoiler :
Code:
from CvPythonExtensions import *
import sys
import Popup as PyPopup
from PyHelpers import PyPlayer
import pickle
import CvEventManager
from CvScreenEnums import *
from PyHelpers import *
import CvUtil
import CvAdvisorUtils
import PyHelpers
import Consts as con

# globals
gc = CyGlobalContext()
localText = CyTranslator()

DefaultUnitAI = UnitAITypes.NO_UNITAI

iTundra = con.iTundra
iThinsoil = con.iThinsoil
iGrass = con.iGrass
iPlains = con.iPlains
iSnow = con.iSnow    
     
TURNS_PER_MONTH = 4
FIRST_YEAR = -4000

def getYear(iGameTurn):
    """Returns the calendar year from the 0-based game turn."""
    return iGameTurn / (12 * TURNS_PER_MONTH) + FIRST_YEAR

def getMonth(iGameTurn):
    """Returns the 1-based month # from the 0-based game turn."""
    return iGameTurn / TURNS_PER_MONTH + 1

def getWeek(iGameTurn):
    """Returns the 1-based week # from the 0-based game turn."""
    return iGameTurn % TURNS_PER_MONTH + 1

tSnowMap = (
((	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"40",	"40",	"0",	"0",	"0",	"0",	"60",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	),
(	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	"0",	)),
)

def SnowCover(pPlot):
	iTurn = gc.getGame().getGameTurn()
	iMonth = getMonth(iTurn)
	iWeek = getWeek(iTurn)
	snow = tSnowMap[159-pPlot.getY()][pPlot.getX()]
	if iWeek == 1
		if iMonth == 1:
			if (snow == "10"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "20"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "30"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 2:
			if (snow == "40"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "50"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "60"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 3:
			if (snow == "70"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "80"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "90"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "100"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 4:
			if (snow == "110"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "120"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "130"):
				pPlot.setTerrainType(iSnow,True,True)
			elif (snow == "140"):
				pPlot.setTerrainType(iSnow,True,True)
		elif iMonth == 6:
			if (snow == "110"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow == "120"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow == "130"):
				pPlot.setTerrainType(iGrass,True,True)
			elif (snow == "140"):
				pPlot.setTerrainType(iPlains,True,True)
		elif iMonth == 7:
			if (snow == "70"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow == "80"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow == "90"):
				pPlot.setTerrainType(iGrass,True,True)
			elif (snow == "100"):
				pPlot.setTerrainType(iPlains,True,True)
		elif iMonth == 8:
			if (snow == "40"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow == "50"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow == "60"):
				pPlot.setTerrainType(iGrass,True,True)
		elif iMonth == 9:
			if (snow == "10"):
				pPlot.setTerrainType(iTundra,True,True)
			elif (snow == "20"):
				pPlot.setTerrainType(iThinsoil,True,True)
			elif (snow == "30"):
				pPlot.setTerrainType(iGrass,True,True)

The new error is: *drumroll

Spoiler :

Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 2, in ?
File "<string>", line 52, in load_module
File "WinterModEventManager", line 7, in ?
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
File "
WinterMod2
", line
62


if iWeek == 1













^
SyntaxError
:
invalid syntax

Failed to load python module CvEventInterface.
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
Traceback (most recent call last):

File "CvAppInterface", line 47, in onSave

AttributeError: 'module' object has no attribute 'onEvent'
ERR: Python function onSave failed, module CvAppInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ETC ETC ETC


the spacing looks correct (it is inline with the line above it, using tabs) and I can't think of what else the syntax error could be.
 
You need a colon after an if test:

Code:
if iWeek == 1[B][COLOR="Orange"]:[/COLOR][/B]

No more free syntax checking. :p
 
Sorry :p that one should have been obvious, if not because of my knowledge, because all the other if statements have colons next to them

I fixed the remaining errors as well as the errors in the way I wrote the code

It is now working perfectly; I will be expanding it to do a variety of things, change features, and soon for flooding and equatorial seasonal purposes; I'll post if I run into any trouble

Though I am also curious why your code is having no effect despite the refresh graphics and no errors

Thanks for helping out when the need (real or imagined) arose :goodjob:
Although I can't just put my ideas into python, I find I am understanding it a lot better than when I started

Kevin
 
Glad you got that working. It was fun when I first did my code to see the terrain change over time. As for why my code isn't working, do you have a link to the post that contains the code you're using? It's been over a year since I worked on that I think, and it was for someone else to boot.

I do remember though that I used cultural ownership of a tile to denote the week each tile should freeze/thaw. Have you modified my code to use your table instead of the cultural ownership?

The reason I used that is that you can assign ownership in WorldBuilder. The idea was to use WB to "paint" the zones, convert it to a table in Python, and then use that going forward. If you're comfortable building that information directly in a table, you're a step ahead.
 
The thread was "Help! Can't add new methods to CvEventManager!"

I think i deleted half of it, but I remember testing with all of the code and it didn't work then either. Then again, if it had to do with cultural borders, then that's probably why.

However, in the piece of code I tested with, I don't see the culture-painting-function anywhere. I guess it was in the half I deleted

EDIT: yes, in the thread, it says it requires a pre-built map. I didn't see that. That would be why
 
Top Bottom