View Issue Details

IDCategoryLast Update
0002901Bug Report2020-07-06 16:37
Reporterskrskrskr 
SeverityminorReproducibilityalways
Status newResolutionopen
Summary0002901: Method is_state of class Machine fails when Machine is NOT_INIT
DescriptionThere is a bug in method is_state of the Machine class. If the machine object is not initialized (NOT_INIT), attribute _state is None. This may lead to a Renpy exception, which can be observed when calling two cookie jar scenes in a specific order (e.g. Consuela BJ followed by Roz BJ):

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/scripts/characters/roz/scene/blowjob.rpy", line 10, in script
    if M_consuela.is_state(S_con_job_ambush):
  File "game/scripts/characters/roz/scene/blowjob.rpy", line 10, in <module>
    if M_consuela.is_state(S_con_job_ambush):
  File "game/scripts/core/systems/FSM/state_machine.rpy", line 763, in is_state
    if self._state in states:
  File "game/scripts/core/systems/FSM/state_machine.rpy", line 68, in __eq__
    raise TypeError
TypeError:

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

Full traceback:
  File "game/scripts/characters/roz/scene/blowjob.rpy", line 10, in script
    if M_consuela.is_state(S_con_job_ambush):
  File "Q:\Games\SummertimeSaga-0-20-1-pc\renpy\ast.py", line 1832, in execute
    if renpy.python.py_eval(condition):
  File "Q:\Games\SummertimeSaga-0-20-1-pc\renpy\python.py", line 2059, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "Q:\Games\SummertimeSaga-0-20-1-pc\renpy\python.py", line 2052, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/scripts/characters/roz/scene/blowjob.rpy", line 10, in <module>
    if M_consuela.is_state(S_con_job_ambush):
  File "game/scripts/core/systems/FSM/state_machine.rpy", line 763, in is_state
    if self._state in states:
  File "game/scripts/core/systems/FSM/state_machine.rpy", line 68, in __eq__
    raise TypeError
TypeError:

Windows-8-6.2.9200
Ren'Py 7.3.5.606
SummertimeSaga 0.20.1
Mon Jul 06 18:06:50 2020

Apparently, Consuela's scene sets M_consuela to NOT_INIT and _state to None.

A possible fix is to add a check like this in that method:

        def is_state(self, *states):
            if len(states) == 1 and isinstance(states[0], (list, tuple, set)):
                states = states[0]
            if self._state is None: # Fix if machine is not initialized
                return False
            if self._state in states:
                return self._state.delay == 0
Platform/OSWindows
Version0.20

Activities

skrskrskr

skrskrskr

2020-07-06 16:37

reporter   ~0004951

Remark: I count this as a minor bug since it might only affect the cookie jar and can be skipped with Ignore. But it might affect other parts of the game as well.

Issue History

Date Modified Username Field Change
2020-07-06 16:35 skrskrskr New Issue
2020-07-06 16:37 skrskrskr Note Added: 0004951