Danv
Well-Known Member
- Aug 21, 2020
- 1,545
- 2,357
- 428
trying to make two lists - one with all characters, other with colors of those characters
using
i can get list of all characters, in format ['mc', 'npc1', 'npc2', ...]
now i can test grabbing name and color from the list
which returns
but when i'm trying to make list of colors
renpy dies with
what i'm missing here?
edit:
ffs took me two days to figure it out and after i finally decided to ask for help - 20 minutes later i found solution
using
Python:
char_list = []
for name, value in store.__dict__.items():
if isinstance(value, renpy.store.ADVCharacter) and hasattr(value, 'name') and isinstance(value.name, basestring):
char_list.append(str(name))
now i can test grabbing name and color from the list
Python:
test1 = None
test2 = None
if char_list:
test1 = char_list[0]
test2 = str((renpy.python.py_eval(char_list[0])).who_args["color"])
test1 = 'mc' and test2 = '#FF0000', so everything still workingbut when i'm trying to make list of colors
Python:
color_list = []
for char in char_list:
color_list.append(str((renpy.python.py_eval(char)).who_args["color"]))
KeyError: u'color' errorwhat i'm missing here?
edit:
ffs took me two days to figure it out and after i finally decided to ask for help - 20 minutes later i found solution
Python:
for char in char_list:
try:
color_list.append(str((renpy.python.py_eval(char)).who_args["color"]))
except:
color_list.append('#adadad')
Last edited: