I tried using the stat system from the DSE as an add-on the visual novel I'm creating. I defined the stats (Intelligence and Charm) and launched the game. But when it came time to display the stats, the game crashed and I got this traceback:
Note: I've abbreviated the file locations for privacy, but the full line is completely necessary, I'll post it.
Code: Select all
I'm sorry, but an exception occured while executing your Ren'Py
script.
AttributeError: 'module' object has no attribute 'charm'
While running game code:
- script at line 220 of .../game/script.rpy
- python at line 220 of .../game/script.rpy.
- python at line 51 of .../game/stats.rpy.
- python at line 39 of ...game/stats.rpy.
-- Full Traceback ------------------------------------------------------------
File "...\renpy-6.10.0\renpy\bootstrap.py", line 260, in bootstrap
File "...\renpy-6.10.0\renpy\main.py", line 308, in main
File "...\renpy-6.10.0\renpy\main.py", line 92, in run
File "...\renpy-6.10.0\renpy\execution.py", line 230, in run
File "...\renpy-6.10.0\renpy\ast.py", line 557, in execute
File "...\renpy-6.10.0\renpy\python.py", line 927, in py_exec_bytecode
File ".../game/script.rpy", line 220, in <module>
File ".../game/stats.rpy", line 51, in display_stats
File ".../game/stats.rpy", line 39, in normalize_stats
AttributeError: 'module' object has no attribute 'charm'
While running game code:
- script at line 220 of .../game/script.rpy
- python at line 220 of .../game/script.rpy.
- python at line 51 of .../game/stats.rpy.
- python at line 39 of .../game/stats.rpy.
Ren'Py Version: Ren'Py 6.10.0e
Code: Select all
$ display_stats()
Code: Select all
def normalize_stats():
for s in __dse_stats:
v = getattr(store, s.var)
if v > s.max:
v = s.max
if v < 0:
v = 0
setattr(store, s.var, v)
def display_stats(name=True, bar=True, value=True, max=True):
[b] normalize_stats()[/b]
ui.window(style=style.stats_frame)
ui.vbox(style=style.stats_vbox)
layout.label("Statistics", "stats")
for s in __dse_stats:
[b]v = getattr(store, s.var)[/b]
ui.side(['l', 'r', 'c'], style=style.stat_side)
if name:
layout.label(s.name, "stat")
else:
ui.nul()
if value and max:
layout.label("%d/%d" % (v, s.max), "stat_value")
elif value:
layout.label("%d" % (v,), "stat_value")
elif max:
layout.label("%d" % (max,), "stat_value")
else:
ui.null()
if bar:
ui.bar(s.max, v, style=style.stat_bar)
else:
ui.null()
ui.close()
ui.close()