This snippet is enough to show the issue:
Code: Select all
define e = Character('Eileen', color="#c8ffc8")
# The game starts here.
label start:
e "This is just a test"
$ myArray = [ 'a', 'b', 'c' ]
e "The game will crash if I go to 'Variable Viewer' in the Developer Menu!"
return
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
KeyError: "'a', 'b', 'c'"
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Program Files (x86)\renpy-6.13.7\renpy\execution.py", line 261, in run
File "C:\Program Files (x86)\renpy-6.13.7\renpy\ast.py", line 630, in execute
File "C:\Program Files (x86)\renpy-6.13.7\renpy\python.py", line 978, in py_exec_bytecode
File "common/_developer.rpym", line 85, in <module>
File "common/00layout.rpy", line 191, in list
File "C:\Program Files (x86)\renpy-6.13.7\renpy\ui.py", line 435, in __call__
File "C:\Program Files (x86)\renpy-6.13.7\renpy\text\text.py", line 1033, in __init__
File "C:\Program Files (x86)\renpy-6.13.7\renpy\text\text.py", line 1076, in set_text
File "C:\Program Files (x86)\renpy-6.13.7\renpy\substitutions.py", line 218, in substitute
File "string.pyo", line 549, in vformat
File "string.pyo", line 571, in _vformat
File "string.pyo", line 632, in get_field
File "string.pyo", line 591, in get_value
KeyError: "'a', 'b', 'c'"
Windows-post2008Server-6.1.7601-SP1
Ren'Py 6.13.7.1646
A Ren'Py Game 0.0
I have tried replacing the list with a tuple and with a dictionary and in both cases things worked fine.
Knowing that the expected output for the case above would be "[ 'a', 'b', 'c' ]", it looks like the engine is attempting to process that string for interpolation.
EDIT:
I just tested the same sample on Ren'Py 6.12.2 and it worked fine. While correlation doesn't necessarily imply causality, the fact that the []-based syntax for interpolation was added on Ren'Py 6.13 is worth taking in account, at the very least.
The Developer Menu looks like it uses the same GUI functions as games themselves to render the text, so: are the square brackets in the text generated by the variable viewer properly escaped?
EDIT2:
Solved! Indeed, the new interpolation syntax was the culprit.
Changing common/_developer.rpym line 81 from this:
Code: Select all
entries.append((0, (var + " = " + val).replace("{", "{{")))
Code: Select all
entries.append((0, (var + " = " + val).replace("{", "{{").replace("[", "[[")))
EDIT3:
Just thought of a minor glitch for the solution above: when a string contains a literal '[' (which needs to be typed in code as '[[' to properly escape it), the variable viewer will show the brackets doubled. IMHO, this shouldn't be a real issue, since other escape sequences such as '\n' are also displayed "as typed", so I think this "doubling" of '[' characters may be even desirable for consistency.