PDA

View Full Version : Request: Print/Save Char Sheet?



hartmaab
August 5th, 2008, 19:01
It sure would be nice to have the ability to have the character sheet print or make a .pdf for offline consideration. Not sure if this is doable, or how it might get done, but I think it would be handy for planning your character when the DM's server isn't available.

Spyke
August 5th, 2008, 19:19
I did this the other day to run my FG scenario face-to-face. The way I solved it was to take screenshots using PrintKey (https://www.webtree.ca/newlife/printkey_info.htm), drop them into an MS Word document, and then print to pdf using PrimoPDF (https://www.primopdf.com/).

It only took me a couple of minutes, and my players actually went 'wow' when they saw the character sheets! :)

Spyke

hartmaab
August 6th, 2008, 14:59
That's a decent hack. Would prefer a more straight forward method though, especially to automagically handle scaling, page breaks, tabs, etc.

Spyke
August 6th, 2008, 19:01
True, it would be useful to have this integral to FG, but it's something that would have to be added by SmiteWorks themselves, as the LUA input and output functions have not been exposed to us, which makes sense as it limits the mischief we can get up to. ;)

The only way I can think of this being added by the community would be if someone wrote a completely separate program that built the output from the xml files, but even that would be tricky as sometimes what's visible on the sheet is controlled from within scripts.

You can take screenshots directly from within FG by pressing the print screen key. These appear in your FG application folder, and you could print those directly from the folder, or crop first in your favourite graphics program.

Spyke

Spyke
August 6th, 2008, 20:30
On reflection, there is a way we could do this, but it would take a lot of effort and would have to be done separately for each ruleset. Theoretically, one could write a routine which would output HTML code to the debug console. The user would then cut and paste that section from console.log (found in the FG application folder) into a separate document, and that could be displayed for printing in a browser.

Anyone got a lot of spare time on their hands? ;)

Spyke

Foen
August 7th, 2008, 06:34
The issue is the dynamic nature of ruleset rendering, so that you cannot tell from the character xml or the ruleset windowclass xml what the rendered sheets will look like unless you reperform the rendering process and all of the associated scripts.

It would be much easier if FG exposed the current internal rendering state as an xml tree (much like you can access the current document in DHTML).

Until then, I think the screenshot approach it the neatest.

Stuart

icedcrow
August 18th, 2008, 14:48
This makes me want to write a small windows app to harvest the character's xml data and then print it out in character sheet format.

I will pull up some xml data from characters in my campaign (4th edition ruleset) and see what I can come up with.

It will be a small .NET app if I do it.

joshuha
August 18th, 2008, 17:25
This makes me want to write a small windows app to harvest the character's xml data and then print it out in character sheet format.

I will pull up some xml data from characters in my campaign (4th edition ruleset) and see what I can come up with.

It will be a small .NET app if I do it.

The issue becomes rerendering all the data. With things being in lists/tabs/etc. you essentially have to reparse everything. For a known ruleset like d20 this wouldn't be hard but for custom or third party rulesets the data structures could be very different and you have to make logic decisions based on data structures.

I thought about doing something like this before but I feel like essentially you are just rewriting FGs XML parser. Seems like a lot of work to make a printable sheet. I think an alternate would be to have some development standards for a Export sheet option. This way every ruleset could have a common API to export informaiton into a HTML presentable sheet.

icedcrow
August 18th, 2008, 17:54
Yeah it would be a lot of work when it would be cool to have it in the parent app, but if one really wants the ability one must sometimes go to lengths.

Essentially all I would do is read the xml file in, place the data in character class objects and then create a report file and render it that way, assigning the data as an objectdatasource.

Should take about a couple hours. Just have to find those couple hours.

Griogre
August 18th, 2008, 20:51
You might be able to cheat a bit too for D&D. Instead of doing your own render you could re-arange the XML to match with a program like the 3eProfiler or 4ePofiler export so you could then store and print them on one of those websites.

But to do an arbitrary character sheet it would be easier if Smiteworks did it for the reasons Josh mentioned.

Valarian
October 24th, 2008, 08:44
Translation of the XML to HTML should be possible using XSLT. As with an application, the XSLT template would have to change for each ruleset. It may be a way of getting an application to be able to convert several rulesets though. Use the application to select the db.xml file, the Id of the character and the XSLT template to use, then parse and save the HTML.

Foen
October 24th, 2008, 17:03
Hmm, this would work for many aspects of the character sheet but some of the sheet can be created dynamically using script "createControl" and "addWindow" functions, and hence wouldn't render using XSLT.

This would be a very good start, however, and bundling the XSLT with each new ruleset using a standard filename might help automate the character sheet printing.

Stuart

Valarian
October 24th, 2008, 18:34
Depends on what you want. A graphical reproduction of the sheet in FGII wouldn't be possible. A sheet giving teh details of the character in a HTML form should be. I'll have to dig out my XML books and look at an XSLT script, it's been a while since I've needed to touch it.

Foen
October 24th, 2008, 18:51
Very good point. In which case I think it should be encouraged that XML->HTML XSLT translators should perhaps be bundled with new rulesets (using a standard filename?).

Stuart

Valarian
October 24th, 2008, 23:44
I've done a quick test of the XSLT concept which seems to be working so far.

XSLT code for the d20 base ruleset (partial): charsheet.xsl


<xsl:stylesheet version="1.0"
xmlns:xsl="https://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Fantasy Grounds D20 Character</title>
</head>
<body>
<xsl:for-each select="root/charsheet/*[starts-with(name(), 'id')]">
<h2><xsl:value-of select="name"/></h2>
<hr/>
<table border="2">
<tr bgcolor="PaleGreen">
<th>Race</th>
<th>Alignment</th>
<th>Age</th>
<th>Gender</th>
<th>Height</th>
<th>Weight</th>
<th>Size</th>
</tr>
<tr>
<td><xsl:value-of select="race"/></td>
<td><xsl:value-of select="alignment"/></td>
<td><xsl:value-of select="age"/></td>
<td><xsl:value-of select="gender"/></td>
<td><xsl:value-of select="height"/></td>
<td><xsl:value-of select="weight"/></td>
<td><xsl:value-of select="size"/></td>
</tr>
</table>
<br/>
<table border="0">
<tr>
<td colspan="3">
<table border="2">
<tr>
<th bgcolor="PaleGreen"></th>
<th bgcolor="PaleGreen">Score</th>
<th bgcolor="PaleGreen">Bonus</th>
</tr>
<tr>
<th bgcolor="PaleGreen">Strength</th>
<td><xsl:value-of select="abilities/strength/score"/></td>
<td><xsl:value-of select="abilities/strength/bonus"/></td>
</tr>
<tr>
<th bgcolor="PaleGreen">Dexterity</th>
<td><xsl:value-of select="abilities/dexterity/score"/></td>
<td><xsl:value-of select="abilities/dexterity/bonus"/></td>
</tr>
<tr>
<th bgcolor="PaleGreen">Constitution</th>
<td><xsl:value-of select="abilities/constitution/score"/></td>
<td><xsl:value-of select="abilities/constitution/bonus"/></td>
</tr>
<tr>
<th bgcolor="PaleGreen">Intelligence</th>
<td><xsl:value-of select="abilities/intelligence/score"/></td>
<td><xsl:value-of select="abilities/intelligence/bonus"/></td>
</tr>
<tr>
<th bgcolor="PaleGreen">Wisdom</th>
<td><xsl:value-of select="abilities/wisdom/score"/></td>
<td><xsl:value-of select="abilities/wisdom/bonus"/></td>
</tr>
<tr>
<th bgcolor="PaleGreen">Charisma</th>
<td><xsl:value-of select="abilities/charisma/score"/></td>
<td><xsl:value-of select="abilities/charisma/bonus"/></td>
</tr>
</table>
</td>
<td colspan="2"></td>
<td colspan="3">
<table border="2">
<tr bgcolor="PaleGreen">
<th>AC</th>
<th></th>
<th>Armour</th>
<th>Shield</th>
<th>Natural</th>
<th>Size</th>
<th>Misc</th>
<th>Temp</th>
</tr>
<tr>
<td><xsl:value-of select="ac/totals/general"/></td>
<td><b> = 10 + </b></td>
<td><xsl:value-of select="ac/sources/armor"/></td>
<td><xsl:value-of select="ac/sources/shield"/></td>
<td><xsl:value-of select="ac/sources/naturalarmor"/></td>
<td><xsl:value-of select="ac/sources/size"/></td>
<td><xsl:value-of select="ac/sources/misc"/></td>
<td><xsl:value-of select="ac/sources/temporary"/></td>
</tr>
<tr>
<td><xsl:value-of select="ac/totals/flatfooted"/></td>
<td colspan="7">Flatfooted</td>
</tr>
<tr>
<td><xsl:value-of select="ac/totals/touch"/></td>
<td colspan="7">Touch Attack</td>
</tr>
</table>
<br/>
<table border="2">
<tr bgcolor="PaleGreen">
<th>HP</th>
<th>Wounds</th>
<th>Non-Lethal</th>
</tr>
<tr>
<td><xsl:value-of select="hp/total"/></td>
<td><xsl:value-of select="hp/wounds"/></td>
<td><xsl:value-of select="hp/nonlethal"/></td>
</tr>
</table>
</td>
</tr>
</table>
<br/>

<hr/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Generated HTML: d20-character.html


<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Fantasy Grounds D20 Character</title>
</head>
<body>
<h2>Amelyn</h2>
<hr>
<table border="2">
<tr bgcolor="PaleGreen">
<th>Race</th><th>Alignment</th><th>Age</th><th>Gender</th><th>Height</th><th>Weight</th><th>Size</th>
</tr>
<tr>
<td>Human</td><td>LG</td><td>18</td><td>Female</td><td>6'</td><td>150</td><td>Medium</td>
</tr>
</table>
<br>
<table border="0">
<tr>
<td colspan="3">
<table border="2">
<tr>
<th bgcolor="PaleGreen"></th><th bgcolor="PaleGreen">Score</th><th bgcolor="PaleGreen">Bonus</th>
</tr>
<tr>
<th bgcolor="PaleGreen">Strength</th><td>17</td><td>3</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Dexterity</th><td>14</td><td>2</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Constitution</th><td>16</td><td>3</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Intelligence</th><td>14</td><td>2</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Wisdom</th><td>18</td><td>4</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Charisma</th><td>18</td><td>4</td>
</tr>
</table>
</td><td colspan="2"></td><td colspan="3">
<table border="2">
<tr bgcolor="PaleGreen">
<th>AC</th><th></th><th>Armour</th><th>Shield</th><th>Natural</th><th>Size</th><th>Misc</th><th>Temp</th>
</tr>
<tr>
<td>18</td><td><b> = 10 + </b></td><td>4</td><td>2</td><td>0</td><td>0</td><td>0</td><td>0</td>
</tr>
<tr>
<td>16</td><td colspan="7">Flatfooted</td>
</tr>
<tr>
<td>12</td><td colspan="7">Touch Attack</td>
</tr>
</table>
<br>
<table border="2">
<tr bgcolor="PaleGreen">
<th>HP</th><th>Wounds</th><th>Non-Lethal</th>
</tr>
<tr>
<td>52</td><td>32</td><td>0</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<hr>
<h2>Gilbert</h2>
<hr>
<table border="2">
<tr bgcolor="PaleGreen">
<th>Race</th><th>Alignment</th><th>Age</th><th>Gender</th><th>Height</th><th>Weight</th><th>Size</th>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
</table>
<br>
<table border="0">
<tr>
<td colspan="3">
<table border="2">
<tr>
<th bgcolor="PaleGreen"></th><th bgcolor="PaleGreen">Score</th><th bgcolor="PaleGreen">Bonus</th>
</tr>
<tr>
<th bgcolor="PaleGreen">Strength</th><td>10</td><td>0</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Dexterity</th><td>10</td><td>0</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Constitution</th><td>10</td><td>0</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Intelligence</th><td>10</td><td>0</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Wisdom</th><td>10</td><td>0</td>
</tr>
<tr>
<th bgcolor="PaleGreen">Charisma</th><td>10</td><td>0</td>
</tr>
</table>
</td><td colspan="2"></td><td colspan="3">
<table border="2">
<tr bgcolor="PaleGreen">
<th>AC</th><th></th><th>Armour</th><th>Shield</th><th>Natural</th><th>Size</th><th>Misc</th><th>Temp</th>
</tr>
<tr>
<td>10</td><td><b> = 10 + </b></td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
</tr>
<tr>
<td>10</td><td colspan="7">Flatfooted</td>
</tr>
<tr>
<td>10</td><td colspan="7">Touch Attack</td>
</tr>
</table>
<br>
<table border="2">
<tr bgcolor="PaleGreen">
<th>HP</th><th>Wounds</th><th>Non-Lethal</th>
</tr>
<tr>
<td>0</td><td>0</td><td>0</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<hr>
</body>
</html>

Foen
October 25th, 2008, 06:04
Looks very promising - is there a way to apply this solely to a target character (specified as a parameter) rather than iterating through all of them? It might be handy to create html rendering of different characters as different files, so they each print on new pages.

Stuart

Valarian
October 25th, 2008, 07:32
Probably, XSLT has got parameters and variables you can set but I can't remember how they're used. You'd probably also need a HTML form or something to set them.

MeepoSose
February 23rd, 2009, 06:54
I know this is an older thread, but it piqued my interest a long time ago and I just now found time to work on it some. I like the idea of an XSLT doc included with each ruleset to allow printing of the chars. This one is specific to 4E and generates a sheet for each player with a horizontal rule between each. I expect the devs could add in a prompt and modify the first for-each statement to only print a specific character.

To use it,
1. Save the zip file to a folder and unzip it
2. Make sure your Web Browser is set to print background colors (IE is Tools | Options | Printing | Print background colors)
3. download XML Notepad (for free)
4. open the db.xml file from the campaign you want to print from within XML Notepad
5. Click the XSL Output tab
6. Click the Open XSLT File Dialog and browse for the .xsl file in the archive from step #1
7. Click on the Transform button with XSL Notepad
8. Verify everything looks good
9. Right click in the window over the document and click Print Preview

MeepoSose
February 23rd, 2009, 07:10
I may be able to add the extra sheet for all the power cards later. I doubt it will be too difficult and we should be able to color them according to the type of power.

Perhaps someone who works with XML/XSL more than I can look it over and make any improvements they deem worthy.

Foen
February 23rd, 2009, 07:55
Really neat! If each ruleset had a bundled character.xsl, then this could be really handy.

Foen

Callum
February 23rd, 2009, 12:06
That's great! I'd love to have a d20 version of this.

Valarian
February 23rd, 2009, 18:41
Building on the last posting ... an XSL translation for the character sheet from my Mongoose Traveller extension. I've added in the parameterisation for printing a single character (or all of them). There's also a basic method to split a list in to columns. I'm sure there's a way to do this more dynamically, but my CSS / HTML / XSL isn't good enough.

MeepoSose
February 23rd, 2009, 19:36
...and that is exactly why I love this community. Just curious, what do you use to apply the XSL transform? I've done it via a .NET app before but I'm pretty new to using other tools or programs. XML Notepad allows you to apply a doc name but I noticed it ignored the link to the CSS -- hence the redundancy of the style block in the XSL doc. I'm also not sure how or if it allows passing of params.

I'm glad the CSS and layout were not too cryptic. That looks pretty good and I'll be pulling some things from yours too I imagine.

Valarian
February 23rd, 2009, 19:44
I edit XML and Lua (among other things) using the JEdit text editor (https://www.jedit.org). The tool has a plugin for XSLT translation. I just run the db.xml through that as I make changes to the XSL script.

Foen
February 23rd, 2009, 22:35
I think you can apply XSLT to XML directly in IE, by naming the stylesheet somehow. I've never tried it, but I believe it is doable.

MeepoSose
February 24th, 2009, 04:11
Here is an updated XLS and CSS to allow printing of power cards as well. Just follow the same procedure detailed earlier to apply.

MeepoSose
February 24th, 2009, 06:32
That's great! I'd love to have a d20 version of this.

While this was written for 4E, Valarian has shown how easy it is to re-use and modify to fit other rulesets. If someone cranks out a D20 version of this, I'd love to get a copy too. If not, I may eventually do a star wars saga edition and then a D&D 3.5 version.

Valarian
February 24th, 2009, 08:49
Bear in mind that I'm a database developer by trade, and I'm familiar with XML (if not quite the other web content stuff). I don't have any problem reading the stuff presented in the files and understand the reference documentation on the web about it. Not everyone is going to be that comfortable messing around with it. Despite this, I'd say to have a go.

I'm going to be doing XSLT for the other character sheets I've done for Babylon 5 (a d20 variant) and for Conspiracy X. I don't know how long these'll take though, fitting around other stuff.

Oberoten
February 24th, 2009, 08:56
Any chance for a tutorial on this? ;)

It'd be a fine addition to the Wiki and maybe a fine addition for most rulesets. :)

- Obe

Valarian
February 24th, 2009, 09:02
It'd be doing a tutorial on XSLT, and there are far better ones out there than I could do. I'm working mainly by trial and error. :)
I might be able to knock something up on the various bits being used and how they relate to the db.xml.

Oberoten
February 24th, 2009, 09:06
Anything helps. :) I'll see if I can find something as well.... But I haven't even tried trial/error on it yet.

- Obe

Oberoten
February 24th, 2009, 09:27
... weell Phoooey. I wish I had read up on this Xpath stuff before starting to build my first ruleset.

- Obe

MeepoSose
February 24th, 2009, 16:02
Bear in mind that I'm a database developer by trade, and I'm familiar with XML (if not quite the other web content stuff). I don't have any problem reading the stuff presented in the files and understand the reference documentation on the web about it. Not everyone is going to be that comfortable messing around with it. Despite this, I'd say to have a go.

Very true. I assumed you had a software or db background and were already comfortable working with XML to some extent from past posts and how quickly you turned the traveller one around. My point is that if anyone is comfortable working on a ruleset as either a professional dev or just as someone who is not afraid to tinker can probably work their way through the XSL docs with some help from Google now and then. I imagine the 4E file and CSS has an example of nearly everything you'd need to use for almost any character sheet.

I may start looking at what images are available in the ruleset file and maybe look at incorporating those into the layout as well. I should probably go back in and add a bunch of comments as well.

I look forward to seeing your your tutorial and other xsl docs.

Callum
February 27th, 2009, 10:29
I'm not clear from the above messages whether anyone's working on a d20 version of this. If no-one is, I'll start bumbling around, trying to do it myself - but it'll take me much longer than someone who actually knows what they're doing! Alternatively, if a tutorial is going to be available soon, I'll wait for that before I start...

Valarian
February 27th, 2009, 12:59
I'm working on a Babylon 5 (d20) sheet translator.
This may help once it's done for a Fantasy version. It may just confuse further :).
By all means, have a go with what's already there.

Zeus
May 31st, 2009, 10:57
Here is an updated XLS and CSS to allow printing of power cards as well. Just follow the same procedure detailed earlier to apply.

Thankyou MeepoSose, this was just what I have been looking for. I Need some help though.

I have followed the instructions and am able to get character sheets for all the characters in my db.xml file however whilst the main char sheet is listing powers correctly not all powers are being created on the 2nd page for each chararacter.

e.g. I have a Paladin character with the following Powers:

At-Will: Holy Strike, Valiant Strike, Lay on Hands
Encounter: Second Wind, Shielding Smite, Dragon Breath,Channel Divinity: Divine Strength (Extra Damage)
Daily: Paladin's Judgement
Utility: Sacred Circle

Now they all list correctly on the main sheet for the character but only Holy Strike, Valiant Strike, Second Wind, Channel Divinity: Divine Strength (Extra Damage) and Sacred Circle are being displayed on the Power Cards sheet. Paladin's Judgement, Lay on Hands, Shielding Smite and Dragon Breath all seem to get omitted.

Am I doing something wrong? Any assistance would be gratefully appreciated.

Zeus
May 31st, 2009, 11:20
Never mind. I realised I had some errors in the power entries which were screwing up the recharge entries. I fixed these and re-transformed the db.xml file and voila its all working now.

My only challenge now is fixing the XLS output to fit the pages correctly as some of the powers run off the edge of the page and don't continue on the next. Any ideas?

MeepoSose
May 31st, 2009, 20:07
Never mind. I realised I had some errors in the power entries which were screwing up the recharge entries. I fixed these and re-transformed the db.xml file and voila its all working now.

My only challenge now is fixing the XLS output to fit the pages correctly as some of the powers run off the edge of the page and don't continue on the next. Any ideas?

Hey Zephp, glad it's working again. I admit that I only played with this a little after I created it initially and haven't used it much since. Perhaps you can upload your db.xml file and indicate which page is overflowing the printable area. I thought I set it to 100% width but it may depend slightly on the browser being used and your personal printer settings. Of course, it could also just be a typo or mistake in the XSL file I generated. :D