That error is solved but now all I'm getting is a grey placeholder picture with the text written in the middle of it. Here's the script:
Code: Select all
[spoiler]init python:
def define_image(size, side, path_tuple, argList):
path_tuple = tuple(entry for entry in path_tuple if entry is not None)
if side:
path_tuple = ('side', ) + path_tuple
args = []
for i in xrange(1, len(argList), 2):
if argList[i] is not None:
args.extend([(0, 0), argList[i]])
renpy.image(path_tuple, LiveComposite(size, *args))
if 'valerie' in path_tuple:
print path_tuple
if not side:
flipArr = args
for i in xrange(1, len(args), 2):
flipArr[i] = im.Flip(args[i], horizontal=True)
plist = list(path_tuple)
plist.insert(1, 'flip') #flip after char name. eg. sara flip arms_crossed etc.
renpy.image(tuple(plist), LiveComposite(size, *flipArr))
def get_character_indexes():
return {'expressions': {}, 'poses': {}, 'ears': {}, 'freya': {}, 'freya2': {}, 'arms': {}}
def define_chars(characterImageFolder, size=(370, 512), flip=True, side=False):
chars = {}
for path in renpy.list_files():
if path.startswith(characterImageFolder):
pList = path.split("/")
if len(pList) >= 4 and path.startswith(characterImageFolder + pList[-4] + "/poses/"):
if pList[-4] not in chars:
chars[pList[-4]] = get_character_indexes() #New character
if pList[-2] not in chars[pList[-4]]['poses']:
chars[pList[-4]]['poses'][pList[-2]] = {} #New pose
splitVal = os.path.splitext(pList[-1])[0]
if splitVal not in chars[pList[-4]]['poses'][pList[-2]] and splitVal != 'pose':
chars[pList[-4]]['poses'][pList[-2]][splitVal] = path #New outfit
elif len(pList) >= 4 and path.startswith(characterImageFolder + pList[-4] + "/outfits_extra/"):
if pList[-4] not in chars:
chars[pList[-4]] = get_character_indexes() #New character
if pList[-2] not in chars[pList[-4]]['outfits_extra']:
chars[pList[-4]]['outfits_extra'][pList[-2]] = {} #New outfit extra
splitVal = os.path.splitext(pList[-1])[0]
if splitVal not in chars[pList[-4]]['outfits_extra'][pList[-2]]:
chars[pList[-4]]['outfits_extra'][pList[-2]][splitVal] = path #New pose
elif path == characterImageFolder + pList[-2] + '/base.png':
if pList[-2] not in chars:
chars[pList[-2]] = get_character_indexes() #New character
chars[pList[-2]]['base'] = path
elif len(pList) >= 3:
for val in ['outfits', 'poses', 'expressions', 'outfits_extra']:
if path.startswith(characterImageFolder + pList[-3] + "/" + val + "/") and pList[-2] == val:
if pList[-3] not in chars:
chars[pList[-3]] = get_character_indexes()
splitVal = os.path.splitext(pList[-1])[0]
if splitVal not in chars[pList[-3]][pList[-2]]:
chars[pList[-3]][pList[-2]][splitVal] = path
break
for cKey in chars:
character = chars[cKey]
if len(character['outfits']) > 0: #Standard directory structure
for oKey in character['outfits']:
outfit = character['outfits'][oKey]
if len(character['poses']) > 0:
for pKey in character['poses']:
pose = character['poses'][pKey]
define_extra(size, side, character, pose, outfit, cKey, oKey, pKey)
else:
define_extra(size, side, character, None, outfit, cKey, oKey, None)
if len(character['poses']) > 0: #Pose-specific outfits
for pKey in character['poses']:
pose = character['poses'][pKey]
if isinstance(pose, dict):
posePath = characterImageFolder + cKey + '/poses/' + pKey + '/' + 'pose.png'
for oKey in pose:
outfit = pose[oKey]
define_extra(size, side, character, posePath, outfit, cKey, oKey, pKey)
else:
define_extra(size, side, character, pose, None, cKey, None, pKey)
elif len(character['outfits']) == 0 and len(character['expressions']) > 0:
#Base sprite contains pose and outfit
define_extra(size, side, character, None, None, cKey, None, None)
def define_extra(size, side, character, pose, outfit, cKey, oKey, pKey):
for eKey in character['expressions']:
expression = character['expressions'][eKey]
nameList = tuple([cKey, oKey, pKey, eKey])
args = [(0, 0), pose, (0, 0), outfit, (0, 0), expression]
if 'base' in character:
args = [(0, 0), character['base']] + args
define_image(size, side, nameList, args)
for oeKey in character['outfits_extra']:
outfit_extra = character['outfits_extra'][oeKey]
if isinstance(outfit_extra, dict):
if pKey in outfit_extra: #For each pose
nameList = tuple([cKey, oKey, oeKey, pKey, eKey])
define_image(size, side, nameList, args + [(0, 0), outfit_extra[pKey]])
else:
nameList = tuple([cKey, oKey, oeKey, pKey, eKey])
define_image(size, side, nameList, args + [(0, 0), outfit_extra])
[/spoiler]