User:Qazmlpok/nhtohtml

After discovering this tool on the net, I decided to modify it for use in generating wiki pages using the templates. Instead of generating html files, it now generates wiki markup code that can be pasted into an article on this wiki. Running the script will require Perl, a copy of the Nethack/SLASH'EM source code (other variants won't necessarily work, but it could certainly be modified). It is necessary to modify the script to point to the source installation; search for "$nethome" and asjust the directory; be sure to use forward slashes even on windows. The output also includes the encyclopedia entry and a stub message stating that the article was automatically generated. I modified the output to match the existing standards as closely as I could. Since there are a large number of missing SLASH'EM monster articles, this should be useful to fill in the missing pages, or the Vanilla articles with missing conveyance chances, source references, and attributes.

Some deficiencies:
 * Experience and Difficulty are not available from the source code. The values are available for the vanilla monsters, but I don't know how to calculate them for the missing SLASH'EM monsters.
 * The encyclopedia entry is not formatted very well. I wrapped it in the new template, but I believe manual formatting is still necessary. I don't know of a good way to automatically format it.

And some additions:
 * After discovering how magic resistance works, natural magic resistance is mentioned on the resistances section. I'm surprised it was never mentioned before; I had no idea angels were magic resistant AND are the right size to wear DSM.
 * Similarly, level drain resistance is mentioned. Death magic is mention if the monster specifically is immune to death magic (in SLASH'EM), e.g. the higher angelic beings.
 * Resistance chance is calculated. This is something that was missing from the original nhtohtml (and a good number of articles on this wiki). Telepathy, Teleportitis, and teleport control are also mentioned on the conveyances table, as are several hard-coded specials, like a mind flayer corpse giving +1 intelligence or a chameleon causing polymorph. If the monster never leaves a corpse the conveyances table is blanked, as there is no way to get the intrinsics even if the monster "conveys" them (swallowing attacks do NOT work for this; I've tried)

If anyone has any suggestions on way to improve the output, they'd be appreciated. Here's the full source. Perl is far from my best language, so I'm sure the script contains inefficiencies or unusual code.

(5/4) Alright, just updated the code. I believe it is properly calculating the difficulty and base experience, with help from Ion Frigate's code analysis. Random sampling on the data seems to confirm the results; difficulty matches up everywhere I checked, experience matches up in most places as well. Experience seems to include incorrect values on the wiki though; the killer bee article states 19 base experience, Monsters (by difficulty) says 21, while wizard mode and my program give me 31. I'm assuming the bug in experience line 76 is the cause of at least some of the discrepancy; thanks to whoever annotated the source as I definitely would have overlooked that myself. Other minor changes are including "appears in (small/large/very large) groups" in the frequency, and better article support; it no longer says "A Demogorgon" on the attributes list.

I'll probably start using this to fill in some SLASH'EM articles over next week if no one else has any suggestions for improving the output.

http://www.mediafire.com/?nokzzlzyznz

And sample output: