{"id":198,"date":"2010-03-05T08:43:43","date_gmt":"2010-03-05T16:43:43","guid":{"rendered":"http:\/\/gm.sagotsky.com\/?p=198"},"modified":"2010-03-05T08:44:19","modified_gmt":"2010-03-05T16:44:19","slug":"some-stuff-i-made-4e-syntax-highlighting","status":"publish","type":"post","link":"http:\/\/gm.sagotsky.com\/?p=198","title":{"rendered":"Some stuff I made &#8211; 4e syntax highlighting"},"content":{"rendered":"<p>I made a couple tools to help with my 4e game. \u00c2\u00a0They&#8217;re of limited appeal and they&#8217;re still works in progress, but someone out there might find them interesting.<\/p>\n<p>If you haven&#8217;t heard of vim or LaTeX (the typesetting system, not the material) this post doesn&#8217;t concern you and should be ignored unless you&#8217;re having a really boring day.<\/p>\n<p><!--more-->So I tried D&amp;D Insider for a month and was unimpressed. \u00c2\u00a0I liked having access to the data itself, but the tools to access it were unacceptable and I couldn&#8217;t justify paying to use them. \u00c2\u00a0 So I made my own.<\/p>\n<p>The first is a syntax highlighter for vim. \u00c2\u00a0This takes plain text and attempts to colorize it to look vaguely like a 4th ed book. \u00c2\u00a0I 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.<\/p>\n<p>To start with, here&#8217;s a 4th ed NPC I made called the <a href=\"http:\/\/files.sagotsky.com\/sysadmin.4e.txt\">Belligerent Sysadmin<\/a>. \u00c2\u00a0I didn&#8217;t look at any books for this, so don&#8217;t even pretend it&#8217;s usable for a game. \u00c2\u00a0It&#8217;s a text file that uses the same layout as WotC&#8217;s compendium. \u00c2\u00a0Well, 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.<\/p>\n<p>By itself, the file is a wall of text. \u00c2\u00a0With vim highlighting, you get this:<\/p>\n<p><a href=\"http:\/\/gm.sagotsky.com\/wp-content\/uploads\/2010\/03\/sysadmin.4e.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-199\" title=\"sysadmin.4e\" src=\"http:\/\/gm.sagotsky.com\/wp-content\/uploads\/2010\/03\/sysadmin.4e.png\" alt=\"\" width=\"570\" height=\"612\" srcset=\"http:\/\/gm.sagotsky.com\/wp-content\/uploads\/2010\/03\/sysadmin.4e.png 570w, http:\/\/gm.sagotsky.com\/wp-content\/uploads\/2010\/03\/sysadmin.4e-279x300.png 279w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><\/a><\/p>\n<p>Much more readable! \u00c2\u00a0At-will and encounter powers conform approximately* to WotC&#8217;s color scheme. \u00c2\u00a0I made up the purple color because I wasn&#8217;t sure what else to use for a recharge ability. \u00c2\u00a0 Certain keywords are highlighted. \u00c2\u00a0Numbers are too.<\/p>\n<p>To get this in vim, download <a href=\"http:\/\/files.sagotsky.com\/4e.vim\">4e.vim<\/a> and put it in your ~\/.vim\/syntax folder. \u00c2\u00a0It will apply 4e syntax to any file with a .4e extension. \u00c2\u00a0You&#8217;ll have to rename the Belligerent Sysadmin above &#8211; I made him .txt for the benefit of your browser.<\/p>\n<p>There&#8217;s some additional code at the bottom of the file for leveling characters and applying templates. \u00c2\u00a0It&#8217;s incomplete and non functional. \u00c2\u00a0If I ever finish I&#8217;ll post updates to it. \u00c2\u00a0Or feel free to finish it on your own.<\/p>\n<p>Also note that .4e is an extension I made up. \u00c2\u00a0It&#8217;s what I used for the compendium text I copied and pasted.<\/p>\n<p>Anyway, I&#8217;ve been using this for a couple weeks to read through enemies. \u00c2\u00a0I quite like it. \u00c2\u00a0The next problem is that vim sucks at printing. \u00c2\u00a0I had to use gvim to get colors to work. \u00c2\u00a0And even then it never came out quite right. \u00c2\u00a0So I kept the regexes from vim and wrote a script to make a LaTeX file with similar highlighting. \u00c2\u00a0That .tex file can be converted to a pdf for pretty printing.<\/p>\n<p>Here&#8217;s a <a href=\"http:\/\/files.sagotsky.com\/sysadmin.pdf\">sysadmin pdf<\/a> I made. \u00c2\u00a0It includes 4 sysadmins to show how they&#8217;d appear if there were several enemies on the page.<\/p>\n<p>I will point out that this is sloppy as hell. \u00c2\u00a0It&#8217;s my second attempt at LaTeX and there was more trial and error than I&#8217;d like to admit. \u00c2\u00a0But it does the job so far. \u00c2\u00a0Here&#8217;s <a href=\"http:\/\/files.sagotsky.com\/4e2latex.sh\">4e2latex.sh<\/a>. \u00c2\u00a0Usage notes are in the comments at the top. \u00c2\u00a0Colors are slightly different than the vim colors, because nobody wants to print a black background. \u00c2\u00a0I believe you need the texlive-latex-extra package for pdflatex. \u00c2\u00a0You should check pdfs before printing them. \u00c2\u00a0Some NPCs get cut off between the columns. \u00c2\u00a0Others don&#8217;t render right, especially if they have conflicting abilities. \u00c2\u00a0(At least one WotC monster has a recharging at will. \u00c2\u00a0They end up getting highlighted as both recharge and at will abilities. \u00c2\u00a0I don&#8217;t plan on correcting this becuase it&#8217;s not a bug in the highlighter, but I failure by WotC to adhere to their own syntax. \u00c2\u00a0Had they used a syntax highlighter when writing their rules maybe they wouldn&#8217;t have so much errata.)<\/p>\n<p>* Colors are approximate because I&#8217;m restricted to 256 colors chosen by xterm. \u00c2\u00a0Yes, you probably want to ensure you&#8217;re running a terminal with lots of colors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I made a couple tools to help with my 4e game. \u00c2\u00a0They&#8217;re of limited appeal and they&#8217;re still works in progress, but someone out there might find them interesting. If you haven&#8217;t heard of vim or LaTeX (the typesetting system, not the material) this post doesn&#8217;t concern you and should be ignored unless you&#8217;re having [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[56,85,59,57,58],"class_list":["post-198","post","type-post","status-publish","format-standard","hentry","category-dnd","tag-4e","tag-dnd","tag-latex","tag-syntax-highlight","tag-vim"],"_links":{"self":[{"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=\/wp\/v2\/posts\/198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=198"}],"version-history":[{"count":2,"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=\/wp\/v2\/posts\/198\/revisions"}],"predecessor-version":[{"id":201,"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=\/wp\/v2\/posts\/198\/revisions\/201"}],"wp:attachment":[{"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=198"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gm.sagotsky.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}