Alas, I have found another bug in xAgeSDLBoolRespond.py. It occurs when you are viewing one particular screen on the control imager in Er'cana (the one where you can see the grinding wheels). On switching to that screen, value become 2 when it should only be 0 or 1. This make the tuple index go out of range and triggers a traceback.
Code: Select all
(07/23 18:46:58) ActScrollRight callback
(07/23 18:46:58) DEBUG: ercaControlRoom.ImgrView(): View = 1, and mode = exit
(07/23 18:46:58) DEBUG: ercaControlRoom.OnSDLNotify(): ercaCtrlImgrView = 2
(07/23 18:46:58) xAgeSDLBoolRespond.OnSDLNotify(): VARname:ercaCtrlImgrView, SDLname:Ercana, value:2, playerID:10104
(07/23 18:46:58) value=2
(07/23 18:46:58) ff=False
(07/23 18:46:58) avatar=<Plasma.ptSceneobject object at 0x18A7D6C0>
(07/23 18:46:58) cPythSDLRespOvenBtns - Traceback (most recent call last):
(07/23 18:46:58) File ".\python\xAgeSDLBoolRespond.py", line 91, in OnSDLNotify
(07/23 18:46:58) self._Execute(value, ff, avatar)
(07/23 18:46:58) File ".\python\xAgeSDLBoolRespond.py", line 99, in _Execute
(07/23 18:46:58) PtDebugPrint("xAgeSDLBoolRespond._Execute():\tRunning %s responder on %s ff=%d" % (resps[int(value)], self.sceneobject.getName(), ff), level=kDebugDumpLevel)
(07/23 18:46:58) IndexError: tuple index out of range
[/color]
Once this happens, none of the control buttons on any screen will display. The 4th, 5th, 6th and 7th lines above are print statements I added to try to figure out what is going on.
My first theory is that in the old script, the test is if
value is TRUE. an integer value of 2 returns TRUE in
if ageSDL[stringVarName.value][0]:. Your script uses the integer value of ageSDL[sdlName.value][0] as an index. On the one screen, ageSDL[sdlName.value][0] returns the value 2.
EDIT: OK, this little hack fixes the problem:
Code: Select all
ageSDL = PtGetAgeSDL()
value = ageSDL[sdlName.value][0]
PtDebugPrint("xAgeSDLBoolRespond.OnSDLNotify():\tVARname:%s, SDLname:%s, value:%d, playerID:%d" % (VARname, SDLname, value, playerID), level=kDebugDumpLevel)
if value:
value = 1 # Hack to make value work properly as an index in _Execute()
This forces
value to be in the proper index range... any value that is not zero is set to 1. It appears the
value is only used to select the correct responder to run... it's actual value is irrelevant as long as it's either 0 or 1.
Perhaps you can come up with a more elegant solution. I put my hack in after the PtDebugPrint() so the actual value of ageSDL[sdlName.value][0] is displayed.