PDA

View Full Version : Print Character Information



Visigodo
January 30th, 2005, 14:16
Is there a way to print the Character sheets Information?

Dupre
January 30th, 2005, 14:25
Sorry, but there is no printing support currently.

You could take a screenshot and print it with an image viewing program, but the quality of the print would be fairly poor.

Visigodo
January 30th, 2005, 14:53
Well screenshot and Paint program works fine, just take a little more work and time but the print is good enough.

Elric
January 30th, 2005, 18:18
If someone could write an xml -> html utility, that might be nice. :D

Visigodo
January 31st, 2005, 15:20
Can we do this kind of 3rd Party programs without going against the license?

Ged
January 31st, 2005, 16:57
You of course need to consder the open gaming license of WOTC, but from the perspecive of Fantasy Grounds, you are free to make such a utility. Click View OGL on the main menu of Fantasy Grounds and you'll find an explicit permission for this in the second paragraph.

Bagpuss2
January 31st, 2005, 22:49
If someone knows a bit more about XSL than me (which would be pretty much anything), can tell me how to pluck the data from the file I'll do the layout.

I've read the Tutorial at http://www.w3schools.com/xsl/xsl_transformation.asp

but that only shows how to get data from between, XML tags.

If the format was:

<root>
<node>
<Strength>12</Strength>
</node>
</root>

then I'ld be able to do it. But its not its.

<root>
<node name="charsheet">
<node name="Mysha">
...
<intvalue name="strength" value="8" />
...
</node>
</node>
</root>

If I knew the XSL to grab the Strength value (which I hope is easy) then I could put together a basic layout for a character sheet.

Bagpuss2
February 1st, 2005, 11:34
Since I was getting nowhere with XSL, I've managed to port the XML file into Excel, and with a couple of long text handling formulas get it down to attribute names and values. Which I've made into a big LOOKUP table.

I'm currently linking the fields with ones from a basic Excel character sheet I've found on the net and should have something ready for testing in a couple of days if not sooner.

I think my main problems are going to be how it handles spellcasters when it adds all there spell information to XML sheet.

Bagpuss2
February 1st, 2005, 16:01
Okay it's complete (slow work day) Itsl posted it in the Armory section. It only works (been tested) for local characters not server ones, and only low level characters.

msd
February 1st, 2005, 23:08
If I knew the XSL to grab the Strength value (which I hope is easy) then I could put together a basic layout for a character sheet.

Here is my (probably bad, but working) example.



<?xml version="1.0"?>
<xsl&#58;stylesheet xmlns&#58;xsl="http&#58;//www.w3.org/TR/WD-xsl">
<xsl&#58;template match="/">
<xsl&#58;for-each select="root/node/node">

<!--Print out character name-->
<b>Character name&#58; </b><xsl&#58;value-of select="@name"/>

<br/>

<!--Print out ac-->
<xsl&#58;for-each select="intvalue&#91;@name='ac'&#93;">
<b>ac&#58; </b><xsl&#58;value-of select="@value"/>
</xsl&#58;for-each>

<br/>

<!--Print out acarmorbonus-->
<xsl&#58;for-each select="intvalue&#91;@name='acarmorbonus'&#93;">
<b>acarmorbonus&#58; </b><xsl&#58;value-of select="@value"/>
</xsl&#58;for-each>

<br/>

<!--Now print out a string value-->

<!--Print out appearance-->
<xsl&#58;for-each select="stringvalue&#91;@name='appearance'&#93;">
<b>appearance&#58; </b><xsl&#58;value-of select="@value"/>
</xsl&#58;for-each>

<br/>

</xsl&#58;for-each>
</xsl&#58;template>
</xsl&#58;stylesheet>


Essentially after navigating to the node that contains all the character info, you just need to grab each of the individual nodes based on their attributes (which is the only unique identifier).

How does this work?
Essentially, every element in the XML has two 'things' - one that we know (the name of the attribute that we are trying to grab, i.e. Strength), and one that we don't know but that we want to know (the value associated with that attribute, i.e. 15).

Finding an actual element based on an attribute name



<xsl&#58;for-each select="intvalue&#91;@name='acarmorbonus'&#93;">


Basically, the brackets allow us to add a filter. The @ says that we are going to use an attribute name. This is telling the machine: "find me all the intvalue elements where the 'name' attribute is set to 'armorbonus'. There is only one which gets us the one element we are looking for. Now we just need to rip out the value from that element.

Getting the value of another attribute within that element



<xsl&#58;value-of select="@value"/>


The previous code a filter to select the appropriate element (knowing that there is only one). Now that we have the element, we just want to grab the value associated with the element 'value'. The above code does that.

This may not be the most elegant way to do this, but it works...if there is a better way, I would like to know.

Hope this helps,
Matt