Game Mastery

Some stuff I made – 4e syntax highlighting

by on Mar.05, 2010, under dnd

I made a couple tools to help with my 4e game.  They’re of limited appeal and they’re still works in progress, but someone out there might find them interesting.

If you haven’t heard of vim or LaTeX (the typesetting system, not the material) this post doesn’t concern you and should be ignored unless you’re having a really boring day.

So I tried D&D Insider for a month and was unimpressed.  I liked having access to the data itself, but the tools to access it were unacceptable and I couldn’t justify paying to use them.   So I made my own.

The first is a syntax highlighter for vim.  This takes plain text and attempts to colorize it to look vaguely like a 4th ed book.  I ended up deviating from 4e style quite a bit when I started thinking about printing, but I think this will still be familiar enough to be useful.

To start with, here’s a 4th ed NPC I made called the Belligerent Sysadmin.  I didn’t look at any books for this, so don’t even pretend it’s usable for a game.  It’s a text file that uses the same layout as WotC’s compendium.  Well, same layout if you copy and paste the compendium files into a text editor, which is what I did while my account was still active.

By itself, the file is a wall of text.  With vim highlighting, you get this:

Much more readable!  At-will and encounter powers conform approximately* to WotC’s color scheme.  I made up the purple color because I wasn’t sure what else to use for a recharge ability.   Certain keywords are highlighted.  Numbers are too.

To get this in vim, download 4e.vim and put it in your ~/.vim/syntax folder.  It will apply 4e syntax to any file with a .4e extension.  You’ll have to rename the Belligerent Sysadmin above – I made him .txt for the benefit of your browser.

There’s some additional code at the bottom of the file for leveling characters and applying templates.  It’s incomplete and non functional.  If I ever finish I’ll post updates to it.  Or feel free to finish it on your own.

Also note that .4e is an extension I made up.  It’s what I used for the compendium text I copied and pasted.

Anyway, I’ve been using this for a couple weeks to read through enemies.  I quite like it.  The next problem is that vim sucks at printing.  I had to use gvim to get colors to work.  And even then it never came out quite right.  So I kept the regexes from vim and wrote a script to make a LaTeX file with similar highlighting.  That .tex file can be converted to a pdf for pretty printing.

Here’s a sysadmin pdf I made.  It includes 4 sysadmins to show how they’d appear if there were several enemies on the page.

I will point out that this is sloppy as hell.  It’s my second attempt at LaTeX and there was more trial and error than I’d like to admit.  But it does the job so far.  Here’s  Usage notes are in the comments at the top.  Colors are slightly different than the vim colors, because nobody wants to print a black background.  I believe you need the texlive-latex-extra package for pdflatex.  You should check pdfs before printing them.  Some NPCs get cut off between the columns.  Others don’t render right, especially if they have conflicting abilities.  (At least one WotC monster has a recharging at will.  They end up getting highlighted as both recharge and at will abilities.  I don’t plan on correcting this becuase it’s not a bug in the highlighter, but I failure by WotC to adhere to their own syntax.  Had they used a syntax highlighter when writing their rules maybe they wouldn’t have so much errata.)

* Colors are approximate because I’m restricted to 256 colors chosen by xterm.  Yes, you probably want to ensure you’re running a terminal with lots of colors.

:, , , ,
1 comment for this entry:
  1. Tangents and time sinks - Game Mastery

    […] flavors of syntax highlighting for game text. In my defense, I did this at […]

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...