vaendryl / Sunrider

source code of the visual novel 'Sunrider'
http://sunrider-vn.com/
41 stars 21 forks source link

battle_dispatcher doesn't work #43

Closed vaendryl closed 9 years ago

vaendryl commented 9 years ago

clicking a unit will crash the game saying battle_dispatcher isn't defined.

fixing line 905 and 909 to say self.battle_dispatcher instead gives this error:

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/combatlabels.rpy", line 69, in script
    $BM.battle()  #continue the battle
  File "game/combatlabels.rpy", line 69, in <module>
    $BM.battle()  #continue the battle
  File "game/classes.rpy", line 909, in battle
    self.battle_dispatcher[self.result]()
TypeError: unhashable type: 'RevertableList'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/combatlabels.rpy", line 69, in script
    $BM.battle()  #continue the battle
  File "D:\renpy-6.18.0-sdk\renpy\ast.py", line 778, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "D:\renpy-6.18.0-sdk\renpy\python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/combatlabels.rpy", line 69, in <module>
    $BM.battle()  #continue the battle
  File "game/classes.rpy", line 909, in battle
    self.battle_dispatcher[self.result]()
TypeError: unhashable type: 'RevertableList'

Windows-7-6.1.7601-SP1
Ren'Py 6.18.0.635
Sunrider First Arrival  Beta 6.1
vaendryl commented 9 years ago

in other words, if you were to type this into the console BM.battle_dispatcher[ ['selection',sunrider] ] returns this RevertableList error, which means the except code is being run at line 909 so there is a different error going on triggering an exception

vaendryl commented 9 years ago

setting BM.result to ['selection',sunrider] manually though en then running BM.battle_selection works as you would assume...

vaendryl commented 9 years ago
removing the try-except shows this error:
While running game code:
  File "game/combatlabels.rpy", line 69, in script
    $BM.battle()  #continue the battle
  File "game/combatlabels.rpy", line 69, in <module>
    $BM.battle()  #continue the battle
  File "game/classes.rpy", line 905, in battle
    self.battle_dispatcher[self.result[0]]()
TypeError: battle_selection() takes exactly 1 argument (0 given)

which is interesting, as the only argument is self

vaendryl commented 9 years ago

astounding. changing it to self.battle_dispatcher[self.result[0]](BM) actually seems to fix it :O

but fuck, I really need to leave for work now lol