' % (story['createdAt'], story['publicId'], escape(story['title']), '' if 'isOwner' not in story or story['isOwner'] else ' - %s' % escape(story['user']['username'])))
htmlfile = open('%s.html' % story['publicId'], 'w', encoding='utf-8')
htmlfile.write("""
%s
%s
DetailsDescription: %s Created at: %s Updated at: %s%s Remember: %s Author's note: %s""" % (escape(story['title']), escape(story['title']), nlescape(story['description']), escape(story['createdAt']), escape(story['updatedAt']), '' if 'isOwner' not in story or story['isOwner'] else ' Author: %s' % escape(story['user']['username']), nlescape(story['memory']), nlescape(story['authorsNote'])))
htmlfile.write('Discarded actions')
for action in story['undoneWindow']:
htmlfile.write('%s' % (action['type'], escape(action['createdAt']), nlescape(action['text'])))
if action != story['undoneWindow'][-1]:
htmlfile.write('')
htmlfile.write('')
if 'worldInfo' in story and type(story['worldInfo']) is list and len(story['worldInfo']) > 0:
htmlfile.write('World info')
for entry in story['worldInfo']:
if 'keys' in entry and 'entry' in entry:
htmlfile.write('%s: %s' % (escape(entry['keys']), nlescape(entry['entry'])))
if entry != story['worldInfo'][-1]:
htmlfile.write('')
htmlfile.write('')
htmlfile.write('')
for action in story['actions']:
htmlfile.write('%s' % (action['type'], escape(action['createdAt']), nlescape(action['text'])))
htmlfile.write('')
htmlfile.close()
except Exception as e:
print('An error occured converting story %s:' % story['title'])
print('%s: %s' % (type(e).__name__, e))
input("Press enter to dismiss...")
index.write('
Scenarios
')
for scenario in infile['scenarios']:
try:
if 'isOption' not in scenario or scenario['isOption'] != True:
index.write('
' % (scenario['createdAt'], scenario['publicId'], escape(scenario['title']), '' if 'isOwner' not in scenario or scenario['isOwner'] else ' - %s' % escape(scenario['user']['username'])))
htmlfile = open('%s.html' % scenario['publicId'], 'w', encoding='utf-8')
htmlfile.write("""
%s
%s
Created at: %s
Updated at: %s%s
Description
%s
Prompt
%s
Remember
%s
Author's Note
%s
""" % (escape(scenario['title']), escape(scenario['title']), scenario['createdAt'], scenario['updatedAt'], '' if 'isOwner' not in scenario or scenario['isOwner'] else ' Author: %s' % escape(scenario['user']['username']), nlescape(scenario['description']), nlescape(scenario['prompt']), nlescape(scenario['memory']), nlescape(scenario['authorsNote'])))
if 'quests' in scenario and type(scenario['quests']) is list and len(scenario['quests']) > 0:
htmlfile.write('
Quests
')
for quest in scenario['quests']:
htmlfile.write(nlescape(quest))
if quest != scenario['quests'][-1]:
htmlfile.write('')
if 'options' in scenario and type(scenario['options']) is list and len(scenario['options']) > 0:
htmlfile.write('
Options
')
for subscen in scenario['options']:
htmlfile.write('
')
if 'worldInfo' in scenario and type(scenario['worldInfo']) is list and len(scenario['worldInfo']) > 0:
htmlfile.write('
World Info
')
for entry in scenario['worldInfo']:
if 'keys' in entry and 'entry' in entry:
htmlfile.write('%s: %s' % (escape(entry['keys']), nlescape(entry['entry'])))
if entry != scenario['worldInfo'][-1]:
htmlfile.write('')
htmlfile.write('')
if 'gameCode' in scenario and type(scenario['gameCode']) is dict:
htmlfile.write('
Scripts
')
if 'sharedLibrary' in scenario['gameCode']:
htmlfile.write('
Shared library
%s
' % escape(scenario['gameCode']['sharedLibrary']))
if 'onInput' in scenario['gameCode']:
htmlfile.write('
Input modifier
%s
' % escape(scenario['gameCode']['onInput']))
if 'onModelContext' in scenario['gameCode']:
htmlfile.write('
Context modifier
%s
' % escape(scenario['gameCode']['onModelContext']))
if 'onOutput' in scenario['gameCode']:
htmlfile.write('
Output modifier
%s
' % escape(scenario['gameCode']['onOutput']))
htmlfile.write('')
htmlfile.write('')
htmlfile.close()
except Exception as e:
print('An error occured converting scenario %s:' % scenario['title'])
print('%s: %s' % (type(e).__name__, e))
input("Press enter to dismiss...")
index.write('