Displaying GCS Character Sheets

I've had an interesting idea how to display GCS character sheets within a DokuWiki installation.

It's a complex, multi-part idea, but here's the gist:

  • GCS files are XML
  • XML can be easily manipulated via XSLT
    • Normally done for display purposes
  • PHP can run XSLT on XML files
    • DokuWiki pages can include PHP code
    • The phpwikify plugin could be a big help with this
  • JavaScript can also do this
    • DokuWiki can include JavaScript via HTML tags
    • DokuWiki has the ability to include custom scripts
      • The file would be “conf/userscript.js” or I could make this into a plugin and load from the plugin's directory

Basically, I'm hoping to write PHP code to read the character sheet data and display it in the wiki, just like any other page. Unfortunately, I've got no idea how to do this. I've simply done research to confirm that it can be done. This method has the advantage of a speedy website: the PHP code would produce regular HTML that will get put into the website just like every other page. It would be completely seamless.

I will probably chicken out and use the JavaScript approach, since I don't even know where to begin with PHP and the JavaScript XSLT example I looked at was very simple. This should work on any modern browser, so long as JavaScript isn't disabled.

I could even skip the JavaScript step, include a reference to the XSLT file in every GCS file and then display them via an iframe (I hope). The XSLT reference could easily be added by my website build script. This will probably be my short-term solution. The iframe approach could also be used as a noscript fall-back, but I need to remember that iframes require a plugin.

The one difficulty I foresee is the requirement of doing a few calculations to display a character correctly. I'm going to have to learn more about XPath, in order to do this kind of stuff. I probably won't bother with calculating point totals for quite a while, as it's pretty much a moot point, anyway. The character sheet can't be edited without firing up GCS, after all.

The first step I've made toward this lofty goal is to build a GCS export template. This has helped me rough out what I want the final page(s) to look like. From this, I can build a simple XSLT file with only a few relatively simple modifications. There's also the side benefit of giving users that want it a DokuWiki export template.

Regardless, I think this is going to be a fun project to implement and it should make the wiki much more accessible. I know I've gotten quite a number of complaints from people on the SJGames forums along the lines of “I can't read your character sheets, because I'm not installing a program to do that! I'm not using it/helping you with your question!”

Update (11/4/13)

I've got a rough plain-text xsl file built that displays everything just find except for point totals and possibly attribute adjustments from templates. I've even got modifiers showing up the way they're supposed to. As it turns out, calculating points totals seems possible (I'm almost sure of it), but it's going to be a complete and total pain. This may take much longer than I'd hoped.

Update (11/5/13)

I've built a bash script to pull GCS files from the wiki and convert them (using GCS itself) into DokuWiki pages. It does the job, but it has some nasty caveats. The splash screen for GCS pops up over and over while it's running. It's really annoying and completely occupies the screen for the duration, making the screen it's on effectively unusable.

This is from a command-line usage of the program. Big, huge bug. I do believe I filed a bug report about that some three or four years ago. So far, the author has ignored it.

I may incorporate a VNC server into the script and shunt the GUI parts of the program into it. I just have to figure out how to grab the X server's display number on startup of the server.

I really don't like this solution, but it works.

Back to top
CC Attribution-Noncommercial-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0