Jump to content

About This File

I've been making some Python as I go to make life easier when working on the Slaver's Spellbook. Nothing earth-shaking, but I thought I'd post in case someone else found them useful.

 

Currently there's two modules in two files, each with some sample code.

 

Book Tools

 

This is collection of context managers for the CK's almost HTML book format. So for example, this is the first couple of pages from Opus Korneum:

 

#
#	frontspiece illo, maybe a bit much?
#
	img(
		"Textures/docbook/illos/well_behaved.png",
		width='288',
		height='252',
		caption="Well behaved slavegirls pay close attention to their master."
	)
	para("<br>")
	pbreak()
#
#	don't know if I'll keep the drop caps
#
	with Para():
		cap(
			"Seeker! Know you now that you hold in your hands the life's work "
			"of the great mage Korneum, often called \"The Objectionable\", "
			"though rarely to my face and always by lesser minds, jealous of my intellect."
		)
#
#	it's not a purely mental collection though, even if it started out that way
#
	with Para():
		cap(
			"Seeker! Know you that with this book you can gain insight into "
			"and indeed control over, the bodies and minds of Man and Mer, and other races besides. "
			"Know that the potential to cause harm spells is very great; "
			"With these magics, minds can be twisted into helpless dependency, "
			"their owners reduced to sad, twisted parodies of their former selves."
		)

The context managers make sure the tags are closed correctly and there are a pile of convenience functions. Cap()  for instance, applies a normal paragraph with a Drop Cap on the first character. You'll probably want to fiddle with the funcs or write your own, but the classes should be farily solid.

 

Spell Tools

 

This is a parser for esp/esm files. It reads the data in, finds the SPEL group, find the spells and gives you a list with the name, editor_id and formid for each of them. I wrote it mainly so I could auto generate some json I could feed to JsonUtil to auto load some spell lists when you read the spellbook. That script is in there unaltered, but briefly, it works like this:

 


def main():
	ss = Plugin("slavers_spellbook.esp")
	slhp = Plugin("slavers_spellbook_slhp.esp")

	ss.find_spells()
	slhp.find_spells()

	#print [ sp.editor_id for sp in slhp.spells  ]
	print_json(ss.spells + slhp.spells)

Of course, you don't have to make json files with it, and it can probably be extended to make lists of other records.
 


What's New in Version 0.0.2

Released

Replaced esp.pyc with esp.py

 

Fixed a stupid bug in the demo code where I tried to trim formids to six bytes with the modulus operator rather than bitwise AND.



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use